Yes, it is "legal" to do that if that is written in your company policy on how you collect a urine drug screen.
Either as an employment screening or random drug screens, the employee needs to be made aware of that policy and sign a form saying that they are made aware of the policy and agree to comply to submitting to the tests.
So this is company specific really on how to collect the urine. They should not be allowed to bring in their urine, that would NOT be a good practice.
This can be a little confusing with a urine drug screen that is being used to incriminate someone in a court of law. Those procedures and chain of custody are stricter and of a different legal nature.
I understand. One way so that you will not have to be "present" while they are urinating is to have an area without a sink, color the water blue so they can't "DIP" toilet water, get urine cups that have a temperature reading on them, make them empty out pockets and no purses when entering the bathroom.
You would need to be sure to include in the policy that they will be observed while giving the urine sample for a drug screening test. If they consent to that then there is no legal issue. If they don't then you can also state that employment may not be offered, if they do not comply with the procedure.
You would have to have the same procedure for everyone or they could holler discrimination!