While transmission often occurs via dermal contact with an infected person, eggs can become airborne when dislodged from contaminated clothing or linen. Eating food that has been touched by soiled hands can also spread the infection.
Read about how to diagnosis pinworms here.
Source
Leder, K. and Weller, P. "Enterobiasis and trichuriasis" Up to Date. 19 Jan 2011.