Although it is unusual for a physician to do such a test without your knowledge, it is not illegal. In most cases, when you registered to be seen by your new physician, you signed a form giving them permission to treat you using their best judgment. Drug screens (frequently referred to as "Tox screens") are frequently ordered in places like emergency rooms to test for possible causes of changes in mental state, etc. The patient rarely knows they were ordered because they were part of a routine "work up." Most physicians do not order tests without a reason, if only because they want to maintain a good relationship with their patients.
The other reason most physicians do not order such tests without reason is that unless there was a legitimate reason for the test, your insurance will not pay for it and your physician would have to pay the lab fees themselves. Of course, the issue of confidentiality remains, and even with test results in hand, physicians are prohibited from disclosing anything to anyone without your permission.
I would have a talk with the physician, if I were you, and express your concerns. Allow him or her to explain the reason for the test, and explain to them why it was positive *they may not have looked at your past history before ordering it). Perhaps they will realize their error and not only become more attuned to your needs, but those of their other patients as well.