Clarifying the response of soil microbial communities to vegetation restoration is essential to comprehend biogeochemical processes and ensure the long-term viability of forest development. To assess the variations in soil microbial communities throughout the growth of Pinus armandii plantations in the karst region, we utilized the “space instead of time” approach and selected four P. armandii stands with ages ranging from 10 to 47 years, along with a grassland control. The microbial community structure was determined by conducting Illumina sequencing of the 16 S rRNA gene and the ITS gene, respectively. The results demonstrated that afforestation with P. armandii significantly influenced soil microbial communities, as indicated by notable differences in bacterial and fungal composition and diversity between the plantations and the control. However, soil microbe diversity did not display significant variation across stand ages. Moreover, the bacterial community exhibited higher responsiveness to age gradients compared to the fungal community. Soil physicochemical factors play a critical role in elucidating microbial diversity and community composition variations during restoration processes. TN, AN, TP, AP, SOC, AK, and pH were the most significant influencing factors for the composition of bacterial community, while TC, SOC, pH, and TCa were the most significant influencing factors for the composition of fungal community. Our findings indicate substantial changes in soil bacterial and fungal communities across successive stages of development. Additionally, the changes in dominant bacteria and fungi characteristics across the age gradient were primarily attributed to variations in the prevailing soil conditions and chemical factors.