The influence of microhabitat factors on prokaryotic communities within desert ecosystems, particularly those residing in biological soil crusts (biocrusts), remains poorly understood. This study aimed to elucidate the relative importance of different microhabitats, including soil depths, biocrust developmental stages, and shrub cover, in shaping soil prokaryotic communities. To achieve this, we conducted an in-depth investigation of soil prokaryotic communities using high-throughput amplicon sequencing in the Tengger desert, China. Our results showed that difference of soil properties, prokaryotic alpha, beta diversities and abundances of taxa and functional groups primarily differed between soil depths and among biocrust developmental stages. Furthermore, the impact of shrub cover on the aforementioned parameters was found to be modified by biocrust development. Specifically, we observed higher soil nutrient levels in the upper biocrust layer compared to the subsoil, with a consistent increasing trend during biocrust development in both soil layers. Conversely, soil pH displayed contrasting patterns. Prokaryotic alpha diversity exhibited a V-shaped pattern with biocrust development, initially decreasing and then increasing, and was higher in the subsoil compared to the biocrust layer. Additionally, although prokaryotic alpha diversity showed differences between shrub cover or not, the specific effect depended on biocrust stages. Cyanobacteria, phototrophic and nitrogen-fixing prokaryotes were more abundant in the upper biocrust layer, following a unimodal pattern with biocrust development, initially increasing, and then decreasing; while Actinobacteriota and Acidobacteriota showed higher abundance in the subsoil, with varying trends between the two soil depths during biocrust development. Soil pH and total P emerged as key regulators of prokaryotic communities across different microhabitats. This study contributes to our comprehensive understanding of the complex dynamics governing prokaryotic communities in desert ecosystems.