The Taklimakan Desert is the largest desert in China and the second-largest mobile desert in the world. It is characterized by an increasing altitude gradient from north to south. In this study, a total of 48 sand samples were collected in the Taklimakan Desert, and variations in physicochemical parameters and bacterial communities in the samples and the correlation between them were explored. The bacterial community was characterized using 16S rRNA gene sequencing. The obtained taxonomic data revealed significant differences in the relative abundance of bacterial communities and populations among the samples. The predominant phyla were Actinobacteria, Firmicutes, Proteobacteria, and Bacteroidetes. The abundance of Actinobacteria increased gradually while that of Firmicutes decreased gradually with the increase in altitude. At the genus level, the abundance of Bacillus showed a gradual decrease while that of unclassified Micrococcaceae showed a gradual increase. Altitude and pH were the primary factors that shaped the bacterial communities in the desert. Besides, Ca2+ and P were also significantly correlated with the abundance of bacterial communities. The indicator taxa were significant differences in the surface and the subsurface samples.