Selective logging strongly affects forest structure and functions, which has direct and indirect effects on the soil microbial community. However, the effect of selective logging on soil microbial community composition remains unclear. We analyzed the soil microbial diversity and community composition in a pine (Pinus yunnanensis) forest using the Illumina platform for bacterial and fungal sequencing. The results showed that selective logging significantly altered most soil properties and stand attributes. Dominant phyla abundance varied significantly with change of selective logging intensity, affecting soil microbial community composition. The diversity of bacterial community decreased with the increase of selective logging intensity, whereas the diversity of fungi initially decreased and then increased. Soil properties accounted for most of the variation in the soil microbial communities, followed by stand attributes. Stand density (SD), soil pH, and soil moisture directly influenced the diversity of the bacterial communities, and understory species richness (USR), soil organic carbon (SOC), and soil hydrolysable nitrogen (HN) also directly influenced bacterial community composition. However, selective logging intensity affected the diversity and composition of the bacterial communities indirectly via SD, soil pH, HN, SOC, and USR. Similarly, the intensity of selective logging directly affected the diversity of fungal communities and also showed indirect effect on it via SD, soil pH, SOC, HN, C:N ratio, and soil available potassium. Further, selective logging intensity indirectly affected fungal community composition via soil available phosphorus. Our findings could be used to predict the change in the soil microbial community for the management of P. yunnanensis forest.