If there are any open wounds on the nail beds or along the cuticle, make sure they stay clean and bandaged to prevent infection. Purchase better fitting shoes or reduce the activity that led to the loss in the first place. It should take 3-4 months for a toenail to grow back on its own.
If you've ripped a toenail off, it should grow back on its own. While you are letting it grow back, you shouldn't wear shoes that squeeze the toe, or the nail could grow back crookedly and painfully.
The only thing that can be done for missing toenails, assuming this is a congenital issue, is to fix it cosmetically with some application of a false nail. If the nail was pulled off, it will probably grow back.