Spontaneous abortion (SA) imposes significant physical, psychological, and economic burdens on affected families. This study employs network pharmacology and HPLC-MS analysis to investigate the therapeutic mechanisms of Ageratum conyzoides L. in the treatment of SA. Using HPLC-MS, we identified a diverse array of bioactive compounds in Ageratum conyzoides L., including diterpenoid alkaloids (aconitine, mesaconitine, hypaconitine), sesquiterpene lactones (levistilide A), nucleosides (inosine), coumarin derivatives (ligustilide), triterpenoids, and phenolic acids. These compounds were confirmed through retention times and mass spectrometry fragmentation patterns. Network pharmacology analysis identified 27 active components from the plant's secondary metabolites and revealed 514 related targets. In total, 2197 potential targets related to SA were identified, with 220 shared between the plant and disease. Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway analysis identified 196 pathways, including the PI3K-Akt and cancer-related pathways. Molecular docking further confirmed the interactions between major compounds (quercetin, kaempferol, isorhamnetin) and key targets, such as MAPK1 and MAPK3, with strong binding affinities. Pharmacological evaluation showed that Ageratum conyzoides L. corrected Th cell imbalance by inhibiting Th2 cell differentiation, increasing the Th1/Th2 ratio, and enhancing T-bet gene expression. Serum progesterone levels significantly decreased post-abortion. Flow cytometry revealed restored Th1/Th2 differentiation, while qPCR and immunohistochemical analyses confirmed upregulation of T-bet and inhibition of GATA-3 and IL-4 expression. The extract's efficacy was confirmed across multiple experimental groups using ANOVA and Bonferroni post-hoc tests. This study highlights Ageratum conyzoides L.'s potential as a multifaceted therapeutic agent for SA, supported by its comprehensive molecular profile, revealed through HPLC-MS and network pharmacology.