which drug was it?
piperazine is not known to be harmful in pregnancy, and can be prescribed for babies from 3 months of age, so the chances are, if any crossed the placenta, your baby at 34 weeks will be fine
mebendazole is not licensed for use in children under 2, but can be prescribed to babies from six months of age
(these are according to the British National Formulary).
As Colditz saysm, they can't do safety trials in pregnant women, so can't categorically state that there will be no problems for babies, but that doesn't mean there will be!
BTW, just because your dh doesn't think he has threadworms, it doesn't mean he hasn't !"
Make sure you are treating ALL the family, and repeat the dose 2 weeks later in case any of the little buggers escape.
Your children will almost certainly be picking them up at school/ nursery, so you need to train them (the children) to be as scrupulous as possible about washing fingernails after loo and before eating, especially if they suck their thumbs. Oh, and make sure they wear pants/ PJ bottoms in bed.