It could be considered a reasonable search. Most likely, these urine tests are only occurring to guarantee that the child will not develop any life-altering birth defects from drug use. At least knowing that, for example, if the mother tested positive for heroin use during the first trimester, then the OB can prepare an appropriate plan of action for the rest of the pregnancy, delivery, and determine the best placement for the child.
A pregnant person is taking care of two lives, and the child cannot make the decision as to whether he/she wants to be altered by drugs. If the mother cannot maturely think for her child and avoid drugs -particularly illegal ones- during the pregnancy, than it might be best if the child was in a different household.
This might also only be a procedure for one OB. If a woman does not want to do the urine tests, she can go to another OB. I like to look at this like whenever I go to my endocrinologist. I need to give her my blood glucose logs from the past 1-2 weeks in order to help determine whether I need my insulin regimen changed, whereas some of my other diabetic friends have endocrinologists that do not require the blood glucose logs. If I felt like giving away my blood glucose logs is an invasion of my privacy, then I could go to an endocrinologist that does not require these logs.