Foam in the eye could be indication of respiratory disease like Mycoplasma.
Testing would tell you for sure. You'll want to keep a closed flock until you figure it out.
General care for the eyes is to clean with saline, remove pus and apply eye ointment like Terramycin a couple times a day.
If you notice any other accompanying symptoms, then treating them with an antibiotic may be necessary.