It's been clear for a long time that bone stress injuries occur from overuse. Not only military recruits but also athletes are at risk. More recently it has been observed that healthy adults starting a new or intense physical activity or exercise also suffer from stress fractures.
There may not be one single factor for everyone. Women seem to be at higher risk than men. This may have hormonal reasons or it could be biomechanical. For example women have a shorter stride length during marching. They may compensate by lengthening their stride and hitting the ground harder with their heels.
In a recent study from Finland military recruits who had been running before beginning military training had fewer stress fractures. This suggests gradual training may be a way to avoid stress fractures. Other possible factors include genetics, type of exercise, and terrain.