To avoid nail fungus you can spray your feet and the insides of your shoes with antifungal spray or powder.
If you have a nail which is infected with fungus you can use an oinment such as Zetaclear and apply it to all your nails to prevent them from becoming infected.
It is also important not go barefooted in public bathing areas, as these places are notorious for picking up infections. You can always take a pair of thongs with you and wear them to the waters edge.When in water it is also important to be aware that prolonged exposure to water can cause fungus to spread, so try to avoid spending too much time bathing, and when doing washing up or cleaning wear rubber gloves.
Also be aware that if the skin around your nail is cut or has a sore this can give the germs, which cause nail fungus, access to your nail, so be sure not to pick the skin around your nail and if you do have a cut then use an anti-bacterial or anti-septic cream on it.
Finally to stop it spreading to other nails, wash your hands after you touch an infected area, and if you go to a nail salon be sure they use sterilised instruments.