The existence of biogeographic patterns among most free-living microbial taxa has been well established, yet little is known about the underlying mechanisms that shape these patterns. Here, we examined soil bacterial β-diversity across different habitats in the drylands of northern China. We evaluated the relative importance of environmental factors versus geographic distance to a distance–decay relationship, which would be explained by the relative effect of basic ecological processes recognized as drivers of diversity patterns in macrobial theoretical models such as selection and dispersal. Although the similarity of bacterial communities significantly declined with increasing geographic distance, the distance–decay slope and the relative importance of factors driving distance–decay patterns varied across different habitats. A strong distance–decay relationship was observed in the alpine grassland, where the community similarity was influenced only by the environmental factors. In contrast, geographic distance was solely responsible for community similarity in the desert. Even the average compositional similarity among locations in the desert was distinctly lower compared with those in other habitats. We found no evidence that dispersal limitation strongly influenced the β-diversity of bacterial communities in the desert grassland and typical grassland. Together, our results provide robust evidence of habitat specificity for microbial diversity patterns and their underlying drivers. Our findings suggest that microorganisms also have multiple drivers of diversity patterns and some of which may be parallel to some fundamental processes for explaining biodiversity patterns in macroorganisms.