no judgment please, drug use mentioned

I’m a high-risk pregnancy after a loss in my late second trimester a few months ago. I will be having a cerclage put in at 12 weeks for IC. Before I found out I was pregnant recently, I was actively smoking marijuana in different forms due to anxiety, and up until 4 weeks 5 days was the last time (the day before I found out I was pregnant) could this in anyway harm baby? My first OB appointment is October 2nd. I live in an illegal state. What happens when you fail your initial pregnancy test drug test? Marijuana stays in the urine for at least thirty days.