The role of dietary factors in osteoporotic fractures (OFs) in women is not fully elucidated. We investigated the associations between incidence of OF and dietary calcium, magnesium and soy isoflavone intake in a longitudinal study of 48 584 postmenopausal women. Multivariable Cox regression was applied to derive hazard ratios (HRs) and 95 % confidence intervals (CIs) to evaluate associations between dietary intake, based on the averages of two assessments that took place with a median interval of 2⋅4 years, and fracture risk. The average age of study participants is 61⋅4 years (range 43⋅3–76⋅7 years) at study entry. During a median follow-up of 10⋅1 years, 4⋅3 % participants experienced OF. Compared with daily calcium intake ≤400 mg/d, higher calcium intake (>400 mg/d) was significantly associated with about a 40–50 % reduction of OF risk among women with a calcium/magnesium (Ca/Mg) intake ratio ≥1⋅7. Among women with prior fracture history, high soy isoflavone intake was associated with reduced OF risk; the HR was 0⋅72 (95 % CI 0⋅55, 0⋅93) for the highest (>42⋅0 mg/d) v. lowest (<18⋅7 mg/d) quartile intake. This inverse association was more evident among recently menopausal women (<10 years). No significant association between magnesium intake and OF risk was observed. Our findings provide novel information suggesting that the association of OF risk with dietary calcium intake was modified by Ca/Mg ratio, and soy isoflavone intake was modified by history of fractures and time since menopause. Our findings, if confirmed, can help to guide further dietary intervention strategies for OF prevention.