To investigate microbial communities and their contributions to carbon and nutrient cycling along water gradients can enhance our comprehension of climate change impacts on ecosystem services. Thus, we conducted an assessment of microbial communities, metagenomic functions, and metabolomic profiles within four ecosystems, i.e., desert grassland (DG), shrub-steppe (SS), forest (FO), and marsh (MA) in the Altai region of Xinjiang, China. Our results showed that soil total carbon (TC), total nitrogen, NH4+, and NO3− increased, but pH decreased with soil water gradients. Microbial abundances and richness also increased with soil moisture except the abundances of fungi and protists being lowest in MA. A shift in microbial community composition is evident along the soil moisture gradient, with Proteobacteria, Basidiomycota, and Evosea proliferating but a decline in Actinobacteria and Cercozoa. The β-diversity of microbiomes, metagenomic, and metabolomic functioning were correlated with soil moisture gradients and have significant associations with specific soil factors of TC, NH4+, and pH. Metagenomic functions associated with carbohydrate and DNA metabolisms, as well as phages, prophages, TE, plasmids functions diminished with moisture, whereas the genes involved in nitrogen and potassium metabolism, along with certain biological interactions and environmental information processing functions, demonstrated an augmentation. Additionally, MA harbored the most abundant metabolomics dominated by lipids and lipid-like molecules and organic oxygen compounds, except certain metabolites showing decline trends along water gradients, such as N′-Hydroxymethylnorcotinine and 5-Hydroxyenterolactone. Thus, our study suggests that future ecosystem succession facilitated by changes in rainfall patterns will significantly alter soil microbial taxa, functional potential, and metabolite fractions.