AbstractMosses are among the first colonizing organisms after glacier retreat and can develop into thick moss mats during later successional stages. They are key players in N2 fixation through their microbiome, which is an important process for nutrient buildup during primary succession. How these moss–microbe interactions develop during succession is not well studied and is relevant in the light of climate change and increased glacier retreat. We examined how the bacterial communities associated with two moss species of the genus Racomitrium and the underlying soil, as well as moss traits and nitrogen fixation, develop along a successional gradient in the glacier forefield of Fláajökull in southeast Iceland. In addition, we tested whether moss functional traits, such as total carbon (TC) and total nitrogen (TN) contents, moss moisture content, and moss shoot length are drivers of moss and underlying soil bacterial communities. Although time since deglaciation did not affect TN and moss moisture contents, TC and shoot length increased with time since deglaciation. Moss and underlying soil bacterial communities were distinct. While the soil bacterial community structure was driven by moss C/N ratios, the moss bacterial community structure was linked to time since deglaciation, moss C/N ratio, and moss moisture content. Moss N2‐fixation rates were linked to bacterial community composition and nifH gene abundance rather than moss TN or time since deglaciation. This was accompanied by a shift from autotrophic to heterotrophic diazotrophs. Overall, our results suggest that there is little lateral transfer between moss and soil bacterial communities and that moss traits affect moss and soil bacterial community structure. Only moss bacterial community changed with time since deglaciation. In addition, moss N2‐fixation rates are determined by bacterial community structure, rather than moss traits or time since deglaciation. This study on the interplay between succession, mosses, soils, and their bacterial communities will inform future work on the fate of newly exposed areas as a result of glacier retreat.