Recent study results on the association between maternal exposure to ambient air pollution with preterm birth have been inconsistent. The sensitive window of exposure and influence level of air pollutants varied greatly. We aimed to explore the association between maternal exposure to ambient air pollutants and the risk of preterm birth, and to estimate the sensitive exposure time window. A total of 572,116 mother–newborn pairs, daily concentrations of air pollutants from nearest monitoring stations were used to estimate exposures for each participant during 2015–2020 in Chongqing, China. We applied a generalized additive model and estimated RRs and 95% CIs for preterm birth in each trimester and the entire pregnancy period. In the single-pollutant model, we observed that each 10 μg/m3 increase in PM2.5 had a statistically significant effect on the third trimester and entire pregnancy, with RR = 1.036 (95% CI: 1.021, 1.051) and RR = 1.101 (95% CI: 1.075, 1.128), respectively. Similarly, for each 10 μg/m3 increase in PM10, there were 2.7% (RR = 1.027, 95% CI: 1.016, 1.038) increase for PTB on the third trimester, and 3.8% (RR = 1.038, 95% CI: 1.020, 1.057) increase during the whole pregnancy. We found that for each 10 mg/m3 CO increases, the relative risk of PTB increased on the first trimester (RR = 1.081, 95% CI: 1.007, 1.162), second trimester (RR = 1.116, 95% CI: 1.035, 1.204), third trimester (RR = 1.167, 95% CI: 1.090, 1.250) and whole pregnancy (RR = 1.098, 95% CI: 1.011, 1.192). No statistically significant RR was found for SO2 and NO2 on each trimester of pregnancy. Our study indicates that maternal exposure to high levels of PM2.5 and PM10 during pregnancy may increase the risk for preterm birth, especially for women at the late stage of pregnancy. Statistically increased risks of preterm birth were associated with CO exposure during each trimester and entire pregnancy. Reducing exposure to ambient air pollutants for pregnant women is clearly necessary to improve the health of infants.