The germs have to get into the child's eye. The student with pink eye would have to get the germs on something and then the other person would have to touch that and then their eyes. Or the student with pink eye would touch their eye, touch another student and get the germs on the student and then the student would touch their eye.
It can also be transmitted by things like towels. It's pretty contagious. My kids and I have had it a lot because we are immunodeficient. You can give it to yourself from germs in your nose.