Osteoporosis (OP) is a severe global health issue that has significant implications for productivity and human lifespan. Gut microbiota dysbiosis has been demonstrated to be closely associated with OP progression. Melatonin (MLT) is an important endogenous hormone that modulates bone metabolism, maintains bone homeostasis, and improves OP progression. Multiple studies indicated that MLT participates in the regulation of intestinal microbiota and gut barrier function. However, the promising effects of gut microbiota‐derived MLT in OP remain unclear. Here, we found that OP resulted in intestinal tryptophan disorder and decreased the production of gut microbiota‐derived MLT, while administration with MLT could mitigate OP‐related clinical symptoms and reverse gut microbiota dysbiosis, including the diversity of intestinal microbiota, the relative abundance of many probiotics such as Allobaculum and Parasutterella, and metabolic function of intestinal flora such as amino acid metabolism, nucleotide metabolism, and energy metabolism. Notably, MLT significantly increased the production of short‐chain fatty acids and decreased trimethylamine N‐oxide‐related metabolites. Importantly, MLT could modulate the dynamic balance of M1/M2 macrophages, reduce the serum levels of pro‐inflammatory cytokines, and restore gut‐barrier function. Taken together, our results highlighted the important roles of gut microbially derived MLT in OP progression via the “gut‐bone” axis associated with SCFA metabolism, which may provide novel insight into the development of MLT as a promising drug for treating OP.