Grassland afforestation dramatically affects the abiotic, biotic, and ecological function properties of the original ecosystems. Interference from afforestation might disrupt the stasis of soil physicochemical properties and the dynamic balance of microbiota. Some studies have suggested low sensitivity of soil properties and bacterial community to afforestation, but the apparent lack of a significant relationship is probably due to the confounding effects of the generalist habitat and rare bacterial communities. In this study, soil chemical and prokaryotic properties in a 30-year-old Mongolia pine (Pinus sylvestris var. mongolica Litv.) afforested region and adjacent grassland in Inner Mongolia were classified and quantified. Our results indicate that the high richness of rare microbes accounts for the alpha-diversity of the soil microbiome. Few OTUs of generalist (core bacteria) and habitat-specialist bacteria are present. However, the high abundance of this small number of OTUs governs the beta-diversity of the grassland and afforested land bacterial communities. Afforestation has changed the soil chemical properties, thus indirectly affecting the soil bacterial composition rather than richness. The contents of soil P, Ca2+, and Fe3+ account for differentially abundant OTUs such as Planctomycetes and subsequent changes in the ecologically functional potential of soil bacterial communities due to grassland afforestation. We conclude that grassland afforestation has changed the chemical properties and composition of the soil and ecological functions of the soil bacterial community and that these effects of afforestation on the microbiome have been modulated by changes in soil chemical properties.