The objective of this study was to investigate the risk of osteoporosis in patients with herpes zoster (HZ) infection using a nationwide population-based dataset. The Taiwan National Health Insurance Research Database was used to compare data between 11,088 patients aged 20 to 49 years diagnosed with HZ during 1996 to 2010 and a control group of 11,088 patients without HZ. Both cohorts were followed up until the end of 2010 to measure the incidence of osteoporosis. Cox proportional-hazards regression and Kaplan-Meier analyses were used to calculate hazard ratio and cumulative incidences of osteoporosis, respectively. The overall risk of osteoporosis was 4.55 times greater in the HZ group than in the control group (2.48 vs. 0.30 per 1000 person-years, respectively) after adjusting for age, gender, Charlson Comorbidity Index, and related comorbidities. Compared with controls, patients with HZ and subsequent postherpetic neuralgia had a 4.76-fold higher likelihood of developing osteoporosis (95% confidence interval: 2.44-9.29), which was a statistically significant difference (P <0.001). Osteoporosis risk factors included female gender, age, advanced Charlson Comorbidity Index, depression, and postherpetic neuralgia. This study identified HZ is associated with an increased osteoporosis risk. Further evaluation of the value of bone mineral density test in detecting osteoporosis after HZ may be suggested. HZ vaccination could also be evaluated to lower the incidence of HZ and possibly subsequent osteoporosis. Physicians should be alerted to this association to improve early identification of osteoporosis in patients with HZ.