Some medical conditions increase the risk of osteoporosis. For example, patients who must take steroids for a long time may develop osteoporosis because steroids can weaken their bones.