Stress fractures commonly develop in people who have just dramatically increased their level of physical activity. So to prevent them, go slowly. Experts recommend that you never increase your exercise intensity by more than 10% per week. Make sure to warm up and stretch for a few minutes before exercising. Take frequent breaks to give your body a rest. And if you feel pain during exercise, stop. Don't push through it. High impact sports and work activities increase the risk for stress fractures.
Also, using good exercise equipment can help prevent stress fractures. Don't wear worn out running shoes. People who have fallen arches or other anatomical problems may benefit from custom inserts or arch supports in their shoes.
American Academy of Orthopedic Surgeons web site: "Stress Fractures."
Micheli, L. and Jenkins, M. The Sports Medicine Bible, 1995.
Sanderlin, B. American Family Physician, 2003; vol 68: pp 1527-32.