How is prescription medication such as Zoloft, Xanax or colonapin safe during breastfeeding and pregnancy bur medical marijuana is not?

Please explain. The “high” that concerns most associated with medical marijuana is similar to the disruption other prescription medications may cause which is prescribed for the same issues. I would like to hear most people’s thoughts and opinions but would appreciate only educated answers and not opinions on “bad moms and drugs” when recreational use for marijuana is now allowed in many places. Besides, I’m talking about medical marijuana which is not a “street drug.”