Yes, eye infection can cause eye floaters. First , as we know that floaters are basically little blobs of protein that float through the hollow sphere which is filled with a thick, gel like fluid known as the vitreous humor. So when your eyes are infected by some virus, it can easy to have floaters. To treat the floaters, there are many ways. For your situation, you should find out the reason why your eyes are infected, so that you can heal your floaters. And also you can have a surgery. But on the other hand, you should know that proper nutrition can not only prevent new eye floaters from being formed by can decrease their appearance as well. In this way, your eyes that will help to prevent the formation of new floaters and will also promote the eyes natural healing process which, in turn, will reduce the appearance of eye floaters. So you can eat as many water and vitamin rich vegetables as possible.