You need to provide more information about your case, but from reading the short question, you have to find out whether the drug test was court ordered and you can do that by asking your attorney. If you don't have one, then you should go to the courthouse and review all to court orders to see if there is such order. If there is no order, then you don't have to take a drug test. If you do have an attorney and the other side is alleging drug abuse, it is possible that your attorney wants you to do in voluntarily so that he/she could submit the results to the court confront the other side's allegations.
Disclaimer: Please note that this answer does not constitute legal advice, and should not be relied on, since each state has different laws, each situation is fact specific, and it is impossible to evaluate a legal problem without a comprehensive consultation and review of all the facts and documents at issue. This answer does not create an attorney-client relationship.