Worms eat the food that your dog eats so make it hungry and poop a lot. And, yes, they get worms in their poop. That's why you should check their poop regulary.

Lovely, I know.
I'm pretty sure that its every three months. The stuff isn't cheap so I suppose that the vets have the idea of getting more money out of you..