ST-segment elevation myocardial infarction (STEMI), one of the primary factors leading to global mortality, has been shown through epidemiological studies to have a relationship with short-term exposure to air pollutants; however, the association between air pollutants and the outcome of STEMI has not been well studied. The aim of this study was to estimate the impact of air pollutants on the outcomes of STEMI. Data on particulate matter <2.5 μm (PM2.5), <10 μm (PM10), nitrogen dioxide (NO2), and ozone (O3) at each of the 11 air monitoring stations in Kaohsiung City were collected between 1 January 2012 and 31 December 2017. Medical records of non-trauma patients aged > 20 years who had presented to the Emergency Department (ED) with a principal diagnosis of STEMI were extracted. The primary outcome measure was in-hospital mortality. After adjusting for potential confounders and meteorological variables, we found that an increase in the interquartile range (IQR) in NO2was associated with an elevated risk of in-hospital mortality in patients with STEMI. Moreover, there was an observed higher risk of in-hospital mortality associated with an increase in the IQR of NO2during the warm season, specifically in lag 3 (3 days prior to the onset, OR = 3.266; 95%CI: 1.203–8.864,p =0.02). Conversely, an IQR increase in PM10was associated with an increased risk of in-hospital mortality in patients with STEMI in lag 3 (OR = 2.792; 95%CI: 1.115–6.993,p =0.028) during the cold season. Our study suggests that exposure to NO2(during the warm season) and PM10(during the cold season) may contribute to a higher risk of poor prognosis in patients with STEMI.