Primary congenital glaucoma (PCG) and anterior segment defects (ASDs) are rare ocular malformations diagnosed early in life which can cause blindness. Pathogenic variants in several genes have been linked to these conditions, but little is known about nongenetic risk factors. We investigated the association between maternal nutrition and PCG and ASDs in the National Birth Defects Prevention Study, a large population‐based, multicenter case–control study of major birth defects in the United States. Mothers of cases (n = 152) and control infants without a birth defect (n = 9,178) completed an interview which included a food frequency questionnaire capturing usual dietary intake in the year before pregnancy. Maternal nutrition was assessed through individual nutrient intake, calculating a Diet Quality Index for Pregnancy (DQI‐P) score for each mother, and using latent class analysis to empirically derive four dietary patterns. We calculated adjusted odds ratios (aORs) and 95% confidence intervals (CI) using logistic regression. The results for individual nutrients varied, with some having an inverse or U‐shaped pattern of association with increasing intake. The DQI‐P was not associated with risk of PCG and ASDs (aOR 0.91; CI 0.49–1.66, highest vs. lowest quartile). The dietary pattern analysis suggested lower odds among women with a Prudent and Mexican dietary pattern (aOR 0.82, 95% CI 0.52–1.29; aOR 0.80, 95% CI 0.36–1.78, respectively) compared to those with a Western dietary pattern. We found that higher intake of some nutrients and certain dietary patterns may be inversely associated with PCG and ASDs, though caution is urged due to imprecision of estimates.