The conversion of natural forest understories to monoculture plantations of high-value medicinal herbs is widespread in China, yet its long-term impacts on the soil microbiome remain poorly quantified, raising concerns about the long-term sustainability of such agroforestry systems. The soils were sampled from forest understory systems in the Qinling-Bashan Mountains (Shaanxi Province, China), classified as Luvisols according to the World Reference Base for Soil Resources (WRB). Sites included undisturbed native forest (Y), Asarum sieboldii Miq. (ASM) monocultures (3-year: X; 5-year with robust/poor vigor: Q/R), and post-harvest abandoned land (F). To understand how soil microbial communities form and respond to different land uses in terms of composition and function, we combined soil physicochemical analysis, high-throughput 16S rRNA gene sequencing, null model analysis, co-occurrence network construction, and functional prediction. Across the sampling gradient from the original forest to the abandoned land, available soil phosphorus (AP) decreased by over 50%, pH increased from 5.6 to above 7.4, and ammonium nitrogen (\({\text{NH}}_{4}^{ + }\)–N) increased significantly by 80%. This was accompanied by a progressive decline in NST from 0.42 (Y) to 0.16 (F), confirming strengthening deterministic selection. ASM monoculture significantly altered the structure of bacterial communities. As cultivation duration increased, abundant bacterial taxa became more dominant and upregulated genes associated with nutrient acquisition and stress response (e.g., membrane transport). In contrast, rare taxa experienced a substantial loss of diversity and exhibited no consistent directional trends in functional potential, reflecting high context-dependency. Notably, after land abandonment, these trends began to reverse, with abundant taxa decreasing and rare taxa showing signs of recovery. Compared to plots with poor plant growth (R), soil from plots with robust growth (Q) maintained 5.26% higher bacterial richness and had 26% more rare microbial taxa. Network analysis revealed a filtering-driven reorganization of microbial co-occurrence networks, including shifts in module structure and the dominant taxa within them. ASM monoculture induced shifts in soil nutrients and pH, establishing strong environmental filters. These changes increasingly constrained microbial community assembly toward deterministic processes, resulting in reduced diversity, particularly among rare taxa, and ultimately compromising the stability of the overall microbial community. To sustain long-term soil health and productivity, forest-based agroecosystems must conserve soil microbial diversity by mitigating phosphorus depletion and stabilizing soil pH, both of which are essential for microbial resilience.