Earthworms are essential components in temperate forest ecosystems, yet the patterns of change in earthworm-associated microbial communities across different temperate forests remain unclear. This study employed high-throughput sequencing technology to compare bacterial community composition and structure in three earthworm-associated microhabitats (skin, gut, and habitat soil) across three typical temperate forests in China, and investigated the influence of environmental factors on these differential patterns. The results indicate that: (1) From warm temperate forests to cold temperate forests, the soil pH of the habitat decreased significantly. In contrast, the physicochemical properties of earthworm skin mucus exhibited different trends compared to those of the habitat soil. (2) Alpha diversity analysis revealed a declining trend in Shannon indices across all three microhabitats. (3) Beta diversity analysis revealed that the transition from warm temperate deciduous broad-leaved forest to cold temperate coniferous forest exerted the most significant impact on the gut bacterial communities of earthworms, while its influence on the skin bacterial communities was comparatively less pronounced. (4) Actinobacteria and Proteobacteria were the predominant phyla in earthworm skin, gut, and habitat soil, but the trends in bacterial community composition differed among the three microhabitats. (5) Mantel tests revealed significant correlations between bacterial community structures and climatic factors, physicochemical properties of earthworm habitat soil, and physicochemical properties of earthworm skin mucus. The findings of this study offer novel perspectives on the interplay between earthworms, microorganisms, and the environment within forest ecosystems.