there are varying risk factors for osteoporosis including long-term medication.
There are many factors that determine who will develop osteoporosis. The first step in prevention is to determine whether you are at risk, since not everyone is. The risk factors are:
Age. The older you are, the greater your risk of osteoporosis. Your bones become weaker and less dense as you age.
Gender. Your chances of developing osteoporosis are greater if you are a woman. Women have less bone tissue and lose bone more rapidly than men because of the changes involved in menopause.
Family History and Personal History of Fractures as an Adult. Susceptibility to fracture may be, in part, hereditary. Young women whose mothers have a history of vertebral fractures also seem to have reduced bone mass. A personal history of a fracture as an adult also increases your fracture risk.
Race. Caucasian and Asian women are more likely to develop osteoporosis. However, African American and Hispanic women are at significant risk for developing the disease.
Bone Structure and Body Weight. Small-boned and thin women (under 127 pounds) are at greater risk.
Menopause/Menstrual History. Normal or early menopause (brought about naturally or because of surgery) increases your risk of developing osteoporosis. In addition, women who stop menstruating before menopause because of conditions such as anorexia or bulimia, or because of excessive physical exercise, may also lose bone tissue and develop osteoporosis.
Lifestyle. Current cigarette smoking, drinking too much alcohol, consuming an inadequate amount of calcium or getting little or no weight-bearing exercise, increases your chances of developing osteoporosis.
Medications/Chronic Diseases. A significant and often overlooked risk factor in the development of osteoporosis is the use of certain medications to treat chronic medical conditions. Medications to treat disorders such as rheumatoid arthritis, endocrine disorders (i.e. an under-active thyroid), seizure disorders and gastrointestinal diseases may have side effects that can damage bone and lead to osteoporosis.
One class of drugs that has particularly damaging effects on the skeleton is glucocorticoids. The following drugs also can cause bone loss:
excessive thyroid hormones
anticonvulsants
antacids containing aluminum
gonadotropin releasing hormones (GnRH) used for treatment of endometriosis
methotrexate for cancer treatment
cyclosporine A, an immunosuppressive drug
heparin and cholestyramine, taken to control blood cholesterol levels.
https://www.nof.org/prevention/risk.htm