Pollution represents a major threat to biodiversity. A wide class of pollutants tends to accumulate within organisms and propagate within communities via trophic interactions. Thus the final effects of accumulable pollutants may be determined by the structure of food webs and not only by the susceptibility of their constituent species. Species within real food webs are typically arranged into modules, which have been proposed to be determinants of network stability. In this study we evaluate the effect of network modularity and species richness on long-term species persistence in communities perturbed by pollutant stress. We built model food webs with different levels of modularity and used a bioenergetic model to project the dynamics of species. Further, we modeled the dynamics of bioaccumulated and environmental pollutants. We found that modularity promoted the stability of food webs subjected to pollutant stress. We also found that richer food webs were more robust at all modularity levels. Nevertheless, modularity did not promote stability of communities facing a perturbation that shared most features with the pollutant perturbation, but does not spread through trophic interactions. The positive effect of both modularity and species richness on species persistence was cancelled and even reversed when the structure of food web departed from a realistic body size distribution or a hierarchical feeding structure. Our results support the idea that modularity implies important dynamic consequences for communities facing pollution, highlighting a main role of network structure on ecosystem stability.