Genetics definitely plays a role in osteoporosis. Also, some say consumption of soda removes some calcium from the bones. Diet definitely plays a role in this disease as well as aging. Increase intake of calcium and vitamin D are important to good bone health. If the person exericises, it is also an excellent way to prevent osteoporosis. Eating plenty of vegetables and fruit is a benefit and avoidance of cigarettes and alcohol is a must.
There are a lot of risk factors here, some of them behavioral and some of them that cannot be changed. If you want a full rundown on these, please follow this link:
As you can see, many of the factors can't be changed. Most notably, we know that women are much more at risk for this, especially as they get older.
However, there are some risk factors that can be controlled. Important among these are such things as having too little calcium intake and smoking or drinking too much alcohol.
Too much sodium in your diet can lead to the elimination of calcium when urinating and sweating. Sodium is found in table salt and in many processed foods.
Oxalates, can block calcium absorption when both substances are in the same product. Spinach contains oxalates. Although this food has an important role in good health, it should not be considered a source of calcium. Fortunately, oxalates do not block calcium absorption from other foods.
The absorption of calcium and vitamin D becomes more difficult in case of excessive alcohol consumption. To reduce the risk of osteoporosis, do not consume more than one glass of alcohol/ day.