Emerging research findings suggest that airborne particulate matter might be a risk factor for gestational diabetes mellitus (GDM). However, the concentration-response relationships and the susceptible time windows for different types of particulate matter may vary. In this retrospective analysis, we employ a novel robust approach to assess the crucial time windows regarding the prevalence of GDM and to distinguish the susceptibility of three GDM subtypes to air pollution exposure. This study included 16,303 pregnant women who received routine antenatal care in 2018-2021 at the Maternal and Child Health Hospital in Chongqing, China. In total, 2482 women (15.2%) were diagnosed with GDM. We assessed the individual daily average exposure to air pollution, including PM2.5, PM10, O3, NO2, SO2, and CO based on the volunteers' addresses. We used high-accuracy gridded air pollution data generated by machine learning models to assess particulate matter per maternal exposure levels. We further analyzed the association of pre-pregnancy, early, and mid-pregnancy exposure to environmental pollutants using a generalized additive model (GAM) and distributed lag nonlinear models (DLNMs) to analyze the association between exposure at specific gestational weeks and the risk of GDM. We observed that, during the first trimester, per IQR increases for PM10 and PM2.5 exposure were associated with increased GDM risk (PM10: OR = 1.19, 95%CI: 1.07~1.33; PM2.5: OR = 1.32, 95%CI: 1.15~1.50) and isolated post-load hyperglycemia (GDM-IPH) risk (PM10: OR = 1.23, 95%CI: 1.09~1.39; PM2.5: OR = 1.38, 95%CI: 1.18~1.61). Second-trimester O3 exposure was positively correlated with the associated risk of GDM, while pre-pregnancy and first-trimester exposure was negatively associated with the risk of GDM-IPH. Exposure to SO2 in the second trimester was negatively associated with the risk of GDM-IPH. However, there were no observed associations between NO2 and CO exposure and the risk of GDM and its subgroups. Our results suggest that maternal exposure to particulate matter during early pregnancy and exposure to O3 in the second trimester might increase the risk of GDM, and GDM-IPH is the susceptible GDM subtype to airborne particulate matter exposure.