Please don't panic. Take a deep breath. Yes, it's a worm.....sounds like a tapeworm. But it's a minor thing if promptly and properly treated. I don't know about deworming when pregnant, but if not, it can wait until after without any serious health effects. And you'll be happy to know that tapeworms aren't transmissible to humans. You won't find tapeworms in her poop....they don't come out that way.
And after deworming, also make sure you have flea prevention, because that's how tapeworms are spread....through fleas.