Overgrazing and climate change are the main causes of grassland degradation, and grazing exclusion is one of the most common measures for restoring degraded grasslands worldwide. Soil fungi can respond rapidly to environmental stresses, but the response of different grassland types to grazing control has not been uniformly determined. Three grassland types (temperate desert, temperate steppe grassland, and mountain meadow) that were closed for grazing exclusion for 9 years were used to study the effects of grazing exclusion on soil nutrients as well as fungal community structure in the three grassland types. The results showed that (1) in the 0-5 cm soil layer, grazing exclusion significantly affected the soil water content of the three grassland types (P < 0.05), and the pH, total phosphorous (TP), and nitrogen-to-phosphorous ratio (N/P) changed significantly in all three grassland types (P < 0.05). Significant changes in soil nutrients in the 5-10 cm soil layer after grazing exclusion occurred in the mountain meadow grasslands (P < 0.05), but not in the temperate desert and temperate steppe grasslands. (2) For the different grassland types, Archaeorhizomycetes was most abundant in the montane meadows, and Dothideomycetes was most abundant in the temperate desert grasslands and was significantly more abundant than in the remaining two grassland types (P < 0.05). Grazing exclusion led to insignificant changes in the dominant soil fungal phyla and α diversity, but significant changes in the β diversity of soil fungi (P < 0.05). (3) Grazing exclusion areas have higher mean clustering coefficients and modularity classes than grazing areas. In particular, the highest modularity class is found in temperate steppe grassland grazing exclusion areas. (4) We also found that pH is the main driving factor affecting soil fungal community structure, that plant coverage is a key environmental factor affecting soil community composition, and that grazing exclusion indirectly affects soil fungal communities by affecting soil nutrients. The above results suggest that grazing exclusion may regulate microbial ecological processes by changing the soil fungal β diversity in the three grassland types. Grazing exclusion is not conducive to the recovery of soil nutrients in areas with mountain grassland but improves the stability of soil fungi in temperate steppe grassland. Therefore, the type of degraded grassland should be considered when formulating suitable restoration programmes when grazing exclusion measures are implemented. The results of this study provide new insights into the response of soil fungal communities to grazing exclusion, providing a theoretical basis for the management of degraded grassland restoration.