Evidence for the antiquity and importance of microbial pathogens as selective agents is found in the proliferation of antimicrobial defences throughout the animal kingdom. Social insects, typified by crowding and often by low genetic variation, have high probabilities of disease transmission and eusocial Hymenoptera may be particularly vulnerable because of haplodiploidy. Mechanisms they employ to reduce the risk of disease include antimicrobial secretions which are particularly important primary barriers to infection. However, until now, whether or not there is selection for stronger antimicrobial secretions when the risk of disease increases because of sociality has not been tested. Here, we present evidence that the production of progressively stronger antimicrobial compounds was critical to the evolution of sociality in bees. We found that increases in group size and genetic relatedness were strongly correlated with increasing antimicrobial strength. The antimicrobials of even the most primitive semi-social species were an order of magnitude stronger that those of solitary species, suggesting a point of no return, beyond which disease control was essential. Our results suggest that selection by microbial pathogens was critical to the evolution of sociality and required the production of strong, front-line antimicrobial defences.