1. Social networks are considered to be ‘highly modular’ when individuals within one module are more connected to each other than they are to individuals in other modules. It is currently unclear how highly modular social networks influence the persistence of contagious pathogens that generate lifelong immunity in their hosts when between-group interactions are age dependent. This trait occurs in social species with communal nurseries, where juveniles are reared together for a substantial period in burrows or similar forms of containment and are thus in isolation from contact with individuals in other social groups. 2. Our main objective was to determine whether, and to what extent, such age-dependent patterns of between-group interactions consistently increased the fade-out probability of contagious pathogens that generate lifelong immunity in their hosts. We hypothesised that in populations of species where juveniles are raised in communal nurseries, a high proportion of recovered adults in a group would form a ‘protective barrier’ around susceptible juveniles against pathogen transmission, thereby increasing the probability of epidemic fade-out in the population. 3. To test this idea, we implemented a spatially implicit individual-based susceptible–infected–recovered (SIR) model for a large range of generic host and pathogen traits. 4. Our results indicated that (a) the probability of epidemic fade-out was consistently higher in populations with communal nurseries, especially for highly contagious pathogens (high basic reproduction number, R0) and (b) communal nurseries can counteract the cost of group living in terms of infection risk to a greater extent than variation in other traits. 5. We discuss our findings in relation to herd immunity and outline the importance of considering the network structure of a given host population before implementing management measures such as vaccinations, since interventions focused on individuals with high between-group contact should be particularly effective for controlling pathogen spread in hosts with communal nurseries.