Artificial vegetation restoration is an effective method for improving soil quality. In areas experiencing coal mine subsidence, the microbial community is essential for reconstructing the ecological balance of the soil. Studies are needed to examine how soil microbial community structure respond to different artificial forest restoration types and ages, especially over long-term periods. Therefore, in this study, 10, 20, and 30-year trials were chosen with two restoration types: Pinus tabuliformis (PT) and Ulmus pumila (UP). The objective was to determine how various types and ages of forest restoration affect the structure of soil bacterial communities, as well as the soil environmental factors driving these changes. The results showed that artificial 30-year restoration for both PT and UP can improve soil physical and chemical properties more than restoration after 10 and 20 years. The soil bacterial community structure remarkably differed among the different forest types and restoration ages. The bacterial diversity was higher in UP than in PT; the alpha diversity at longer restoration years (30 and 20) was significantly higher than at 10 years for both PT and UP. Moreover, soil nutrients and pH were the primary soil environmental factors driving bacterial community structure in the PT and UP. Finally, the integrated fertility index (IFI) at 30 years of restoration was considerably higher for PT and UP, and thus, is more beneficial to the restoration of soil after coal mining. Our findings are useful for studying improvement in soil quality and the restoration of the ecological environment in mining areas.