Erythromycin is used treating infections caused by certain bacteria. It is also used to prevent bacterial endocarditis and attacks of rheumatic fever. It may also be used for other conditions as determined by your doctor.