Halophytes play a crucial ecological role in drought and saline–alkali environments. However, there is limited knowledge about the structure of bacterial communities and the potential microbial coexistence mechanism associated with halophytes. This study investigated the diversity and community structure of endophytic and rhizospheric bacteria associated with three halophytes by applying high-throughput sequencing and geochemistry analyses on the studied soils. We collected 18 plant and 21 soil samples, and sequenced the V3 and V4 hypervariable regions of the 16S rRNA gene using next-generation sequencing (NGS). We also assessed geochemistry of the studied soils. The research suggested that rhizospheric bacterial richness and diversity associated with three halophytes were all significantly higher than for endophytic bacteria. The microbial community analysis indicated that Actinobacteria, Firmicutes, Bacteroidetes and Proteobacteria were the dominating bacterial phyla. Most unassigned operational taxonomic units (OTUs) implied that the microbes associated with halophytes contained abundant potential novel taxa, which are significant microbial resources. The high-abundance OTU phylogenetic tree supported the above views as well. Additionally, network analysis indicated that some conditional rare taxa (CRT) also might be keystone taxa during halophyte microbial community construction. The results of non-metric multidimensional scaling (NMDS) ordination analysis indicated significant dissimilarities in the microbial community among different sample groups. Sixty-two biomarkers were detected from seven different sample groups by linear discriminant analysis effect size (LEFSe) analysis. Microbial functions predicted based on phylogenetic investigation of communities by reconstruction of unobserved states (PICRUSt2) demonstrated that the abundances of nitrogen metabolism genes of endophytic bacteria were significantly higher than in rhizobacteria. Environmental factor analysis confirmed that different soil properties have different degrees of influence on the abundance and composition of the microbiota. To better adapt to the extreme hypersaline environment, halophytes could specifically recruit some plant beneficial bacterial taxa, such as nitrogen-fixing bacteria and extremely halophilic or halotolerant bacteria, to help them robustly grow and proliferate. All our preliminary results highlight microbial diversity and community related to halophytes grown on saline–alkali land of arid areas. Simultaneously, this work also advanced our further understanding of the halophyte microbiome associated with plants, and their role in plant adaptation to the extremely hypersaline environment.