I don't believe the actual marijuana is as dangerous as say, alcohol, or nicotine, while pregnant.
But smoking ANYTHING is going to be extremely bad for fetal health and potential dangerous to it's survival. Any time you're getting air that's compromised or causes less oxygen to be taken in, it's going to do a lot of damage.
I would be curious as to the effects of, say, eating a marijuana cookie or brownie during pregnancy - but like with most things in pregnancy, there is really no ethical way to study the safety.
I also believe that if you were to use illegal drugs while pregnant, the legal repercussions of getting caught (which may very well happen if you're hospitalized at any time during pregnancy), are far, far, far worse than getting caught while not pregnant. You can pretty much guarantee you'll be doing jail time and won't be seeing your baby until you go through rehab.