Pig manure, as an organic fertilizer, can significantly affect soil nutrient content, pH, and electrical conductivity. Moreover, the accumulation of heavy metals in pig manure and their potential ecological risks are also important concerns in soil management. Additionally, grazing systems may influence soil health and ecological balance by altering the soil microbial community structure. Therefore, this study investigates the impact of grazing Tibetan pigs on soil quality, focusing on the physicochemical properties, heavy metal accumulation, and microbial diversity. In the surface soil after grazing (GS0), pH, EC, AP, and AK were significantly higher than before grazing (NS0) (p < 0.05), while AN showed no significant difference. In the 10 cm soil layer, pH, EC, AK, and AN in GS10 were significantly higher than in NS10 (p < 0.05), whereas AP was significantly lower (p < 0.05). At the 20 cm depth, pH, EC, AP, and AK in GS20 were significantly higher than in NS20 (p < 0.05), but AN was significantly lower (p < 0.05). Overall, AN, AP, and AK decreased with increasing soil depth, while pH and EC showed no significant changes between the 10 cm and 20 cm layers (p > 0.05). In GS0 soil, the contents of Cd(II) and Zn(II) were significantly lower than those in NS0 (p < 0.05), while Pb(II) content was significantly higher (p < 0.05). There were no significant differences in Cu(II), Ni(II), Cr(VI), As(V), and Hg(II) (p > 0.05). In GS10 soil, Ni and Pb(II) contents were higher, whereas Cu(II), Zn(II), and Hg(II) contents were lower. In GS20 soil, Pb(II) and Cr(VI) contents were higher, while Cu(II) and Zn(II) contents were lower. Overall, GS had consistently lower Cd(II), Cu(II), Zn(II), and Hg(II) contents at all depths compared to NS, while Pb(II) and Cr(VI) contents were higher, showing depth-related variation trends, possibly due to plant absorption and heavy metal leaching. Probiotics such as Firmicutes, Bacteroidetes, and Acinetobacter increased significantly in soil, resulting in changes in the soil bacterial community.