Swabs are crucial for detecting the presence of pathogens such as bacteria, viruses, and fungi. By obtaining samples from potentially infected individuals, epidemiologists can perform diagnostic tests to identify the causative agents of infectious diseases. This helps in understanding the spread, prevalence, and incidence of diseases within populations.