It's never a good idea and I too don't understand how anyone could do it while pregnant.
I think we also need to take in to account that the effects pot has directly on the smoker will in turn affect the fetus, even if the pot itself does not.
Such as, smoking pot raises the smoker's heart rate. For a pregnant woman with undiagnosed high blood pressure this could be very dangerous. Even for a pregnant woman who has normal blood pressure, prolonged increased heart rate isn't healthy. It's the same reason you're told not to exercise strenuously while pregnant.
Smoking pot also causes the 'munchies'. Eating well is a must while pregnant, especially if you have gestational diabetes. And when you're stoned and hungry you aren't going to stop and make a balanced meal. You're going to grab a bag of potato chips or a bunch of cake or ice cream.
It also irritates the lungs just like tobacco smokers. If you don't breath well, neither does the baby.
Most women find energy in short supply while pregnant. If you get bronchitis or athsma while pregnant, that's yet more energy and time that your body has to divert to healing itself and fighting the sickness then putting towards the baby and you. And people can die from emphysema, my son's grandfather did last april. It's not something you want to get.