Foot injuries including lost toenails can really hurt your tennis performance. Here I focus on toenails.
I only lost toenails from a violent activity such as hitting hard objects like steel frames when barefoot or while wearing loose shoes. I also saw answers that made sense to me so here are a few plus my own.
1 - Keep nails trimmed.
2 - Buy a fitted shoe.
3 - Use sock liners or double socks.
4 - Employ anti-bacterial and fungal treatments at the first sign of trouble along with excellent hygiene meaning fresh socks and regular washing. (I also used tea tree oil around nails at the first sign of irritation to prevent infections).
5 - Tape ankles, feet, and toes when necessary including (buddy taping for injured toes.)
6 - Allow recovery from injuries.