Herbicides are one of the most widely used chemicals in agriculture. While they are known to be harmful to non-target organisms, the effects of herbicides on the composition and functioning of soil microbial communities remain unclear. Here we show that application of three widely used herbicides—glyphosate, glufosinate and dicamba—increase the prevalence of antibiotic resistance genes (ARGs) and mobile genetic elements (MGEs) in soil microbiomes without clear changes in the abundance, diversity and composition of bacterial communities. Mechanistically, these results could be explained by a positive selection for more tolerant genotypes that acquired several mutations in previously well-characterized herbicide and antibiotic resistance genes. Moreover, herbicide exposure increased cell membrane permeability and conjugation frequency of multidrug resistance plasmids, promoting ARG movement between bacteria. A similar pattern was found in agricultural soils across eleven provinces in China, where herbicide application, and the levels of glyphosate residues in soils, were associated with increased ARG and MGE abundances relative to herbicide-free control sites. Together, our results show that herbicide application can enrich ARGs and MGEs by changing the genetic composition of soil microbiomes, potentially contributing to the global antimicrobial resistance problem in agricultural environments.