Feces excreted by animals can breed pathogens and transmit disease. Important human diseases such as hookworm are transmitted through contact with feces and can be prevented by sanitation measures. Contact with fecal material is not universally detrimental. Some insects do not appear to be harmed by their fecal material, but incorporate into their biology.
The European Earwig, Forficula auricularia, builds nests to raise its young. The walls of the nest are lined with earwig feces. Why? If food is withheld from the earwigs, they will consume the feces to prolong their life. When food is available, the earwigs will consume feces in addition to food.
There may be other benefits. Do earwigs use feces as probiotics? Feces may contain microorganisms that can colonize the gut and aid digestion. Consumption of feces by nest mates would aid transmission of useful microorganisms. Coprophagy (consumption of feces) has been observed for other social insects and has an important role in those colonies.