Elucidating the impact of afforestation on soil bacterial community composition and its potential function in afforestation is imperative for comprehending the biochemical processes of land use change. This study employed high-throughput genomic sequencing to determine the bacterial phylogenetic assembly and assess functional groups following afforestation encompassing shrubland and woodland. Compared with non-afforested cropland, the soil organic carbon (SOC) remained unchanged, but significant alterations were observed in the bacterial composition and potential functions under afforestation. Afforestation enhanced bacterial diversity and even shifted the bacteria from the r- to K-strategy, as indicated by higher oligotroph/copiotroph ratios. Soil properties explained 66.45% and 68.9% of the total variation in bacterial community composition at the phylum level and the functional group. A 60.44% decrease in soil water content, a 3.82% increase in pH, a 7.5% increase in bulk density, and a 66.8% decrease in available phosphorus (AP) were the main soil factors affecting both bacterial community composition and functional traits in afforestation. In particular, lower available nutrients, AP, and nitrate nitrogen in afforestation drive the bacterial life history strategies. We conclude that changes in bacterial metabolic functions due to reduced soil available nutrients from dryland afforestation might be the main driver for microbial-inhibited SOC accumulation. These results could provide strong microbiological evidence to help further evaluate the importance of dryland afforestation.