Background Ambient air pollution has been linked to the risk of gestational diabetes mellitus (GDM). However, evidence of this association is limited, and no study has examined the effects of nitric oxide (NO). Objective This study investigated the association between air pollution exposure during gestation and GDM. Methods The Taiwan Birth Cohort Study database was used to examine the association between the risk of GDM and all routinely monitored air pollutants among 21,248 women who were pregnant during 2004–2005. We further employed a two-pollutant model for confirming the effect of each pollutant on GDM. Results After the exclusion criteria were applied, 19,606 women were included in the final analysis. Among them, 378 (1.9%) had been diagnosed as having GDM. These women were older and had higher BMIs than the women without GDM. The risks of GDM onset were significantly associated with NO exposure during the first [adjusted OR (aOR): 1.05, 95% confidence interval (CI): 1.02–1.08] and second (aOR: 1.05, 95%CI: 1.02–1.08) trimesters. Under the two-pollutant model, the effect of NO exposure was also significant during the first (aOR: 1.05, 95%CI: 1.02–1.08) and second (aOR: 1.05, 95%CI: 1.02–1.09) trimesters. Conclusion The results indicated that exposure to higher NO levels during pregnancy increases the risk of GDM.