The gut microbiota (GM) can regulate bone mass, but its association with incident fractures is unknown. We used Cox regression models to determine whether the GM composition is associated with incident fractures in the large FINRISK 2002 cohort (n = 7043, 1092 incident fracture cases, median follow-up time 18 years) with information on GM composition and functionality from shotgun metagenome sequencing. Higher alpha diversity was associated with decreased fracture risk (hazard ratio [HR] 0.92 per standard deviation increase in Shannon index, 95% confidence interval 0.87-0.96). For beta diversity, the first principal component was associated with fracture risk (Aitchison distance, HR 0.90, 0.85-0.96). In predefined phyla analyses, we observed that the relative abundance of Proteobacteria was associated with increased fracture risk (HR 1.14, 1.07-1.20), while the relative abundance of Tenericutes was associated with decreased fracture risk (HR 0.90, 0.85-0.96). Explorative sub-analyses within the Proteobacteria phylum showed that higher relative abundance of Gammaproteobacteria was associated with increased fracture risk. Functionality analyses showed that pathways related to amino acid metabolism and lipopolysaccharide biosynthesis associated with fracture risk. The relative abundance of Proteobacteria correlated with pathways for amino acid metabolism, while the relative abundance of Tenericutes correlated with pathways for butyrate synthesis. In conclusion, the overall GM composition was associated with incident fractures. The relative abundance of Proteobacteria, especially Gammaproteobacteria, was associated with increased fracture risk, while the relative abundance of Tenericutes was associated with decreased fracture risk. Functionality analyses demonstrated that pathways known to regulate bone health may underlie these associations.