What mechanisms do animals living in groups (herds, packs, swarms) have against spreading contagious diseases?
Three proposed mechanisms:


altruistic self-removal (i.e., diseased individuals leave the group to prevent transmission to kin) has been documented in eusocial insects (ants and bees); Rueppell et al 2010 J. Evol. Biol. say:



  altruistic self‐removal by sick social insect workers to prevent disease transmission is expected under most biologically plausible conditions. The combined theoretical and empirical support for altruistic self‐removal suggests that it may be another important kin‐selected behaviour and a potentially widespread mechanism of social immunity.



social distancing/avoidance: This is a commonly used term in human infectious disease epidemiology for the practice of avoiding contact with infected people. I don't know of any great references, but Loehle 1995 Ecology "Social Barriers to Pathogen Transmission in Wild Animal Populations" says:



  Data on animal behavior in this regard [social avoidance] are sketchy. Sick individuals in cattle herds do seem to be isolated somewhat from the group (L. R. Rittenhouse, Department of Range Science, Colorado State University, and Ray Strickland, University of Maryland, personal communication 1988), though whether by chance (failing to keep up with the group due to listlessness), by voluntary isolation, or by avoidance on the part of others is not clear. Edwards (1988) found a higher degree of investigatory behaviors but a lower degree of touching between other group members and mice infected with Trichinella spiralis, though this disease is not transmissible by contact. This example would fit the proposed behaviors perfectly. More study is needed.



seasonal migration has been proposed as a way for group-living organisms to temporarily leave their habitat, allowing the built-up parasite burden in the environment to diminish before they return; it may also have a group-level effect of filtering out diseased individuals.


Folstad et al. 1991 Can. J. Zool. Parasite avoidance: the cause of post-calving migrations in Rangifer?


  Intensities of warble fly larvae, Hypoderma tarandi (L.), were examined in slaughtered reindeer (Rangifer tarandus tarandus L.) from different summer grazing areas of Finnmark County, northern Norway. To test the hypothesis that larval abundance decreases with increase in post-calving migration distance (i.e., distance from calving grounds), herds with differing migration distances were sampled. The prevalence of infection in the total sample of 1168 animals was 99.9%. The study revealed significant differences in larval abundance among herds from different summer grazing areas. Herds with post-calving migrations have significantly lower larval abundances than herds remaining on or near the calving grounds for the whole summer. Between-herds variation in abundance of H. tarandi larvae is assumed to reflect differing densities of the infective stage (adult flies) on the herds' summer ranges. Larval abundance in a herd is in turn negatively correlated with the distance between the main larval shedding areas (i.e., calving grounds) and the areas of greatest transmission (i.e., summer pastures). These results are discussed in relation to transmission of other parasites common to Rangifer and suggest that this host's post-calving migration may be a behavioural adaptation that reduces levels of parasitic infections.


Loehle 1995 also discusses this (qualitatively/speculatively):


  A more subtle effect results from migration. Consider a species that migrates seasonally some large distance. An area that becomes fouled and unsanitary during one season will become largely clean again by the following year. In between, nest and skin parasites such as ticks and fleas will have nothing to eat and will be greatly reduced in number. For example, wide spacing in rabbits results in reduced flea numbers (Mohr 1963) for these same reasons. Excrement piles will decompose between seasons and wash away. Significant benefits could thus accrue to migratory species, even though long distance migratory behavior is not likely to have arisen from this cause alone. (It may result from predator avoidance [Fryxell et al. 1988], or more commonly be due to weather and food supply factors.) Abandonment of rookeries during the non-mating season might, however, be the result of disease avoidance. Another consequence of migratory behavior is the effect on internal parasites ...  Consideration of epidemiology thus leads to some unexpected benefits of migratory behavior.


Hall et al. 2014 J. Anim. Ecol. "Greater migratory propensity in hosts lowers pathogen transmission and impacts" explore a theoretical model of migration effects.