My wife is pregnant and she bathed my dog not knowing it had worms and now she just defecated with some blood. What is the right course of action?

Watchful waiting. The events are probably coincidental. Bright red bleeding is not uncommon in pregnancy. It can be from hemorrhoids, or fissures. If it continues, medicine can be tried. It is quite unlikely that she has contracted worms from your dog.
Call your MD. I would call your ob/gyn doctor immediately! i don't know what kind of worms your dog had, and whether they could have been transmitted, but any time a pregnant woman passes blood abnormally, this should be evaluated immediately. If you can't reach your doctor by telephone in a short period of time, go to the emergency room. Bleeding can threaten the mother and baby.