Soil bacterial and fungal community communities play significant ecological functions in mountain ecosystems. However, it is not clear how topographic factors and soil physicochemical properties influence changes in microbial community structure and diversity. This study aims to investigate how altitude and slope orientation affect soil physicochemical properties, soil microbial communities, and their contributing factors. The assessment was conducted using Illumina MiSeq sequencing in various altitude gradients and on slopes with different aspects (shady slopes and sunny slopes) in the subalpine meadow of Dongling Mountain, Beijing. Topographical factors had a significant effect on soil physicochemical properties: the primary factors determining the structure of microbial communities are total potassium (TK), ammonium nitrogen (NH4+-N), and soil organic carbon (SOC). There was no significant change in the diversity of the bacterial community, whereas the diversity of the fungal community displayed a single-peaked trend. The effect of slope orientation on microbial communities was not as significant as the effect of elevation on them. The number of bacterial communities with significant differences showed a unimodal trend, while the number of fungal communities showed a decreasing trend. The co-occurrence network of fungal communities exhibits greater intricacy than that of bacterial communities, and bacterial communities are more complex in soils with sunny slopes compared to soils with shady slopes, and the opposite is true for fungal communities. The identification of the main factors that control soil microbial diversity and composition in this study, provided the groundwork for investigating the soil microbial response and adaptation to environmental changes in subalpine meadows.