Xanax is not safe to take during pregnancy. It’s a pregnancy category D drug, which means it can harm your pregnancy. The effects on a pregnancy depend on when in the pregnancy you take Xanax. It can cause serious problems throughout your entire pregnancy, though, so you should avoid it during all three trimesters.