Why might someone still have pinworms after taking medication?

Reinfection. It is because of reinfection from the surroundings as eggs are found on bed linens,bathroom fixtures,drinking glasses,eating utensils,toys,kithcen counters,desks or lunh tables in schools,sandboxes,pyjamas,toilets etc. The reinfection can be prevnted by treating all children&adults in households and repeat the pill two weeks after the initial treatment Pinworms are not caused by playin in dirt.
Recurrent pinworms. after treatment is most likely due to re-exposure to the parasite from contaminated dirt/sand or an infected pet.