Understanding the origin of disease resistance in social insects is difficult due to the lack of well-established phylogenies of presocial and eusocial species and the absence of extant basal and intermediate forms. Moreover, comprehensive accounts of infection-control traits in social insect lineages are not available. Therefore, to explore the evolution of pathogen control in social insects we used cellular automata models to analyze the efficacy of immunity and nest hygiene, which we assumed were basal traits, and allogrooming, which likely followed the transition to eusociality, and their interactions with colony demography and patterns of worker spatial distribution. Models showed that nest hygiene provided an immediate survival benefit and that immunity lowered overall disease susceptibility under both constant and periodic exposure scenarios. Allogrooming increased survivorship in chronically challenged colonies but also increased pathogen transmission rates under conditions of periodic exposure. Colonies having demographies biased towards young or old individuals had slightly higher mortality than those with heterogeneous demographies. The distribution of older individuals relative to the nest center had no significant effect on susceptibility and provided only a minor survival advantage. Models indicated that nest hygiene and immunity function on different temporal scales and can interact with demography to lower disease risks. Our results suggest how infection control systems in social insects could have been built upon the inducible immune defenses and nest hygienic behaviors of solitary and presocial ancestors and served as important preadaptations to manage disease exposure and transmission in colonies of eusocial species.