Sabkhas are hypersaline, mineral-rich, supratidal mudflats that harbor microbes that are adapted to high salt concentration. Sabkha microbial diversity is generally studied for their community composition, but less is known about their genetic structure and heterogeneity. In this study, we analyzed a coastal sabkha for its microbial composition using 16S rDNA and whole metagenome, as well as for its population genetic structure. Our 16S rDNA analysis show high alpha diversity in both inner and edge sabkha than outer sabkha. Beta diversity result showed similar kind of microbial composition between inner and edge sabkha, while outer sabkha samples show different microbial composition. At phylum level, Bacteroidetes (~ 22 to 34%), Euryarchaeota (~ 18 to ~ 30%), unclassified bacteria (~ 24 to ~ 35%), Actinobacteria (~ 0.01 to ~ 11%) and Cyanobacteria (less than 1%) are predominantly found in both inside and edge sabkha regions, whereas Proteobacteria (~ 92 to ~ 97%) and Parcubacteria (~ 1 to ~ 2%) are predominately found in outer sabkha. Our 225 metagenomes assembly from this study showed similar bacterial community profile as observed in 16S rDNA-based analysis. From the assembled genomes, we found important genes that are involved in biogeochemical cycles and secondary metabolite biosynthesis. We observed a dynamic, thriving ecosystem that engages in metabolic activity that shapes biogeochemical structure via carbon fixation, nitrogen, and sulfur cycling. Our results show varying degrees of horizontal gene transfers (HGT) and homologous recombination, which correlates with the observed high diversity for these populations. Moreover, our pairwise population differentiation (Fst) for the abundance of species across the salinity gradient of sabkhas identified genes with strong allelic differentiation, lower diversity and elevated nonsynonymous to synonymous ratio of variants, which suggest selective sweeps for those gene variants. We conclude that the process of HGT, combined with recombination and gene specific selection, constitute the driver of genetic variation in bacterial population along a salinity gradient in the unique sabkha ecosystem.