How can you get pink eye?

By becoming infected.
"Pink eye" is the common name of any number of pathogens that can infect the eyes. Most are contagious by touch transference. So, don't touch, don't contract. Or, touch and effectively wash your hands after and reduce the chances.
Pink eye (conjunctivitis) can be due to infectious or noninfectious causes. It can be a sign of an allergy or an infection with a virus or a bacteria. The white of the eyes appear red and they itch and have a discharge.
Noninfectious pink eye can be caused by allergy,chemical irritation, underlying inflammatory diseases, or trauma. This type can not be transmitted from one person to another.
Infectious pink eye is highly contagious and it can be caused by bacteria or viruses. Do not touch anything that this person has touched, even stay away from him and keep all surfaces very clean.