Pathogens need to enter and establish in the colony to later cause infection of colony members. To prevent colony contamination, ants constantly and prophylactically disinfect their nest, particularly their brood pile, with antimicrobials like their formic-acid rich poison.
Read more on colony hygiene and avoidance of social immunopathology: