Is there medication for pinworms?

Yes. There is at least one over the counter preparation and a prescription chew able tablet in the us.
Pinworm. Medications come in liquid, chewable or tablet forms. They are given in 2 doses, 2 weeks apart. Examples are mebendazole, albendazole, pin-x (non-prescription).
Pinworms. One is Albenza (albendazole) taken as 1 tablet & repeated in 2 weeks. Another is vermox taken same as above.