Yes. One spouse may file a motion to have their soon to be ex-spouse drug tested during a divorce. Ultimately, it will be up to the judge to decide whether or not it is appropriate to order testing. Additionally, a judge can order drug testing on their own without either party requesting it.
Typically a judge will order drug testing, or grant a motion for testing, only if the there is reason to believe drug abuse is occurring. Evidence of drug abuse might include information provided by spouses, witness testimony, or recent prior drug convictions.
If one spouse knows or believe that the other spouse is using drugs, there are two main reasons why you would want them to be drug tested.
1) Evidence of habitual drug use – This would be immensely helpful in obtaining a fault divorce.
2) Child custody – This may help support an argument for sole custody of any children. Moreover, failed drug tests may also be a basis for altering a custody agreement. Bear in mind that usually, "sole" custody does not mean "exclusive" custody, but rather one party has a very large majority of the child’s custody rights.
Keep in mind that if one spouse requests a drug test for the other, it is highly likely that spouse will ask for the same drug test to be done on the requesting party. In most cases, a judge granting one request will also grant the opposing party’s request for drug tests.
If a spouse fails a drug test, they may consider asking for a re-test. There are many legal substances that are known to cause false positive tests.
Trying to get a divorce and custody rights is immensely difficult itself, and only becomes more so when drug use is at issue. A divorce lawyer will be familiar with making the motions required to request a drug test. Additionally, an attorney will be able to use evidence from the test to help achieve your goals. Similarly, if you fail a court ordered drug test during a divorce, your attorney may be able to help you mitigate the damages and persuade the judge that you are not a habitual user.