Drug test at ER?

I know how terrible it sounds but I swear, the information isn't for me. Can the ER legally drug test without your consent when you go into labor? Do the doctors drug test at prenatal check ups? I'm debating with my friend about it, we wanted your input as well! (P.s it doesn't actually apply to either of us, just came up)