To improve nutrient utilization and pathogenic resistance of plants in space, it is crucial to understand the effects of microgravity on the plant root microbiome. However, the finer details of whether and how microgravity affects the root microbiome remain unclear. Here, we found that simulated microgravity elicits no significant changes in fungal community composition and diversity, whether rhizosphere or endophytic. However, simulated microgravity caused a significant change in the composition and diversity of endophytic bacteria of wheat seedlings, but not in rhizosphere bacteria. The alteration of endophytic bacterial communities demonstrates that wheat seedlings adopt strategies to recruit additional endophytic Enterobacteriaceae and increase the stability of the endophytic bacterial network to respond to the challenge of simulated microgravity. Furthermore, our results also suggest that the corresponding changes in endophytic bacteria under simulated microgravity are closely related to a significant decrease in metabolites of the host's carbon metabolism, flavonoid biosynthesis, benzoxazinoid biosynthesis, and tryptophan metabolism pathways. Our findings reveal details important to our understanding of the impact of gravity on the microbial community of plant seedlings and the theoretical basis for manipulation of microorganisms to ensure efficient plant production in space.