This is just a myth. I heard that Filipino believe it. However, in fact, you won't infected by just looking at an infected eye. But if you touch people who with sore eyes, you may infected since you may also touch your eyes after you touch him. It will bring bacterium that cause eye infection to you.
In fact, it is impossible that sore eyes or pink eye can be infected to someone just by looking at the eyes of such a patient. Pin keye is generally caused by germ or virus, so one can only be infected if he/she directly or indirectly comes into contact with secretions or something holding secretions of the patient, such as towel, handkerchief, washbowl or water.
A sore eye is only a specific symptom of various eye disorders, which can be caused by different factors. If the pathogeny is germ or virus, then that would also be infectable, just like pink eye. In other cases, such as stimulation, injury or some kinds of headache can also lead to sore eyes. So it is essential to keep a healthy lifestyle, such as frequently wash your hands and try not to rub eyes even you feel extremely itchy of them. Normally it can be relieved with several drops of ophthalmic saline solution.