What type of workout
Most eye infections
are limited to the outside of the eye and in almost all cases, as long as you are being treated you can exercise.
More importantly than whether you can exercise is the type and location of exercise. It is not a good idea to swim or share gym equipment if you have an infection, since you can transfer it to others. You should ask your eye doctor about your specific infection.