China’s economy has achieved significant success by integrating itself into the globalized production system over an extended period. However, it is crucial to address the environmental consequences that accompany rapid economic progress. The correlation between trade and environmental pollution is still controversial in the existing literature, with a lack of research specifically investigating this relationship using detailed data at the firm level. Based on the quasi-natural experiment of China’s accession to the WTO, this study uses the DID method to evaluate the causal relationship between trade and the environment experimentally. It is found that trade liberalization significantly increases firms’ industrial wastewater emissions, and the empirical results remain robust after parallel trend tests, placebo tests, and replacement variables. The mechanism of action suggests that trade expansion enhances corporate pollution emissions through two channels: attracting foreign investment into the country and intensifying energy consumption. A heterogeneity analysis reveals that the pollution-enhancing effect of trade expansion on enterprises is mainly concentrated in export-oriented enterprises, labor-intensive industries, and coastal regions. Additionally, further analysis shows that trade liberalization not only has local impacts but also spatial spillover effects on enterprise pollution. It is found that enhancing environmental governance and reducing corruption can effectively mitigate the adverse environmental consequences caused by trade liberalization.