Quarantine is essential for controlling the spread of contagious diseases by separating and restricting the movement of individuals who may have been exposed to a pathogen but are not yet symptomatic. This measure helps prevent the disease from spreading to healthy individuals.