Habitat fragmentation and infectious disease threaten amphibians globally, but little is known about how these two threats interact. In this study, we examined the effects of Brazilian Atlantic Forest habitat fragmentation on frog genetic diversity at an immune locus known to affect disease susceptibility in amphibians, the MHC IIB locus. We used a custom high-throughput assay to sequence the MHC IIB locus across six focal frog species in two regions of the Atlantic Forest. We also used a molecular assay to quantify infections by the fungal pathogen Batrachochytrium dendrobatidis (Bd). We found that habitat fragmentation is associated with genetic erosion at the MHC IIB locus, and that this erosion is most severe in frog species restricted to intact forests. Significant Bd infections were recovered only in one Atlantic Forest region, potentially due to the relatively higher elevation. In this region, forest specialists showed an increase in both Bd prevalence and loads in fragmented habitats. We also found that reduced population-level MHC IIB diversity was associated with increased Bd infection risk. On the individual-level, MHC IIB heterozygotes (by allelic genotype as well as supertype) exhibited a reduced risk of Bd infection. Our results suggest that habitat fragmentation increases infection susceptibility in amphibians, mediated at least in part through loss of immunogenetic diversity. Our findings have implications for the conservation of fragmented populations in the face of emerging infectious diseases.