There is currently a paucity of research on the effects of early life exposure to particulate matter (PM) of various size fractions on pneumonia in preschool-aged children. We explored the connections between antenatal and postnatal exposure to atmospheric pollutants and diagnosed pneumonia among 4814 offspring children in Taiyuan City, northern China. Outdoor air pollutant concentrations and ambient temperature were collected. A machine learning-based model was utilized to compute daily mean concentrations of PM10, PM2.5, and PM1 at the home address. Associations were calculated using generalized linear mixed models, and stratified analysis was used to detect sensitive subpopulations. We observed significant associations between prenatal exposure to atmospheric pollutants and the incidence of pneumonia in children. For every 10 μg/m3 increase, the odds ratios (ORs) were 1.06 for PM10, 1.15 for PM2.5, 1.24 for PM1, and 1.05 for SO2 for the whole pregnancy period. In mid-pregnancy, the most vital connections were found for PM10, PM2.5, and PM1 exposure. Girls showed higher sensitivity to exposure to PM2.5 and PM10. The most significant connections between PM and pneumonia were observed at high SO2 exposure. Connections between PM1, PM2.5 and pneumonia were stronger in children without environmental tobacco smoke (ETS) at home. Associations between PM10 and pneumonia were stronger in children with ETS at home. The synthesis of the data suggests that exposure to PM10, PM2.5, PM1, and SO2 during pregnancy contributes to an elevated susceptibility to childhood pneumonia. The second trimester period is significant and represents a critical window of vulnerability. PM1 may have the strongest impact. Exposure to SO2 can further enhance the PM related risks of pneumonia. Gender and ETS exposure at home can modify associations between outdoor PM and pneumonia. Further reductions in outdoor PM, especially PM1, are needed to reduce childhood pneumonia in China.