The cause-effect relationship between iron deficiency anemia (IDA) and osteoporosis has not been established in the general population. Thus, the current longitudinal study determined the role of IDA as a risk factor for osteoporosis by analyzing a large nationwide population-based sample. In a sample of 1,000,000 randomly sampled individuals from the 1998-2012. Taiwan National Health Insurance Research Database, patients with IDA (case group (n = 35,751)) and individuals without IDA (control group (n = 178,755)) were compared. Patients who were <20 years of age and who had pre-existing osteoporosis prior to the diagnosis of IDA were excluded. Each patient with IDA was age- and gender-matched to five individuals without IDA. The diagnoses of IDA and osteoporosis (coded using ICD-9CM) were further confirmed with blood test results and X-ray bone densitometry to ensure the accuracy of the diagnoses. Osteoporosis occurred more often among patients with IDA compared to individuals without IDA (2.27% vs. 1.32%, p < 0.001). Cox proportional hazard analysis revealed that the risk for osteoporosis was significantly higher in the case than the control group (hazard ratio (HR) = 1.74; 95% CI = 1.61-1.88) and remained similar after adjustment for covariates (adjusted HR = 1.81; 95% CI = 1.67-1.97). Compared with individuals without IDA, the risk for osteoporosis was even higher for patients with IDA who received intravenous ferrum therapy (adjusted HR = 2.21; 95% CI = 1.85-2.63). In contrast, the risk for osteoporosis was reduced for patients with IDA who received a blood transfusion (adjusted HR = 1.47; 95% CI = 1.20-1.80). As a predictor, prior IDA is a significant and independent risk factor for development of osteoporosis.