Continuous cropping obstacles have become a serious factor restricting sustainable development in modern agriculture, while companion planting is one of the most common and effective methods for solving this problem. Here, we monitored the effects of companion planting on soil fertility and the microbial community distribution pattern in pepper monoculture and companion plantings. Soil microbial communities were analyzed using high-throughput sequencing technology. Companion plants included garlic (T1), oat (T2), cabbage (T3), celery (T4), and white clover (T5). The results showed that compared with the monoculture system, companion planting significantly increased the activities of soil urease (except for T5) and sucrase, but decreased catalase activity. In addition, T2 significantly improved microbial diversity (Shannon index) while T1 resulted in a decrease of bacterial OTUs and an increase of fungal OTUs. Companion planting also significantly changed soil microbial community structures and compositions. Correlation analysis showed that soil enzyme activities were closely correlated with bacterial and fungal community structures. Moreover, the companion system weakened the complexity of microbial networks. These findings indicated that companion plants can provide nutrition to microbes and weaken the competition among them, which offers a theoretical basis and data for further research into methods for reducing continuous cropping obstacles in agriculture.