You can do several things to prevent ingrown toenails from forming:
Cut your toenails straight across so that the corner of the nail is visible to you, not buried under skin at the side of your nail. If you are not able to see the corner of your nail as you trim it, your nail might have a jagged corner after it is trimmed, with a "forked" edge that can extend under your skin as it grows. Use clippers that are designed to cut toenails, or a nail file.
Wear shoes that are large enough that they don't push your toes together.
If you are elderly, have diabetes or have other conditions that affect your circulation, be especially careful about how you cut your toenails and manage your foot health.