Contact patterns in group-structured populations determine the course of infectious disease outbreaks. Network-based models have revealed important connections between group-level contact patterns and the dynamics of epidemics, but these models typically ignore heterogeneities in within-group composition. Here, we analyse a flexible mathematical model of disease transmission in a hierarchically structured wildlife population, and find that increased variation in group size reduces the epidemic threshold, making social animal populations susceptible to a broader range of pathogens. Variation in group size also increases the likelihood of an epidemic for mildly transmissible diseases, but can reduce the likelihood and expected size of an epidemic for highly transmissible diseases. Further, we introduce the concept of epidemiological effective group size, which we define to be the group size of a hypothetical population containing groups of identical size that has the same epidemic threshold as an observed population. Using data from the Serengeti Lion Project, we find that pride-living Serengeti lions are epidemiologically comparable to a homogeneous population with up to 20 per cent larger prides.