This medication is used to treat certain eye infections (such as conjunctivitis). It is also used to prevent certain eye infections in newborns. It belongs to a class of drugs known as macrolide antibiotics. Erythromycin works by stopping the growth of bacteria. This medication treats only bacterial eye infections.