united-states
There are many different impaired driving offenses in many jurisdictions. Most U.S. jurisdictions have both a strict liability offense, based upon blood alcohol content or an amount of drugs in the driver's system, and a less cut and dried offense based upon actual inability to drive safely.
If someone is driving, knowing they are impaired, and the person is driving in a manner that is not necessary to avoid being raped or assaulted or being harmed from a drug overdose, this is probably still an offense. The proper course of action in that situation, if you know you are impaired and you are not in imminent danger, is to stop the car and seek help by some other means.
Driving while impaired might be legally justified if someone needs to do so to avoid being a victim of a serious crime or suffering serious harm from a drug overdose, under a self-defense or choice of evils type analysis.
Prosecutors also have full discretion to decline to prosecute under the circumstances because the true culprit was someone else and the driver didn't have serious bad intent (or for any other reason, the prosecutor's discretion is effectively absolute).
The case for not prosecuting would be particularly strong if the driver wasn't consciously aware of the impairment, which is an effect that some drugs can have, or if the driver was effectively "sleep driving" in a non-conscious state (which is also a thing, but rare).
Even strict liability offenses typically require some voluntary act, like a voluntary intent to drive the vehicle, even if one doesn't actually have full knowledge that all of the elements of the offense (e.g. that the driver was impaired) exist.
In the same vein, someone who has a sudden health emergency, such as a stroke or heart attack or seizure that wasn't reasonably foreseeable to the driver, is almost never prosecuted criminally for losing control of their car and causing an accident, even when lives are lost.
Also, even if you are guilty of a strict liability offense in these circumstances, or if you failed to take the legally required step of stopping the car upon learning that you are impaired, the fact that someone was secretly drugging in an illegal manner you caused you to commit the offense, would be a strong mitigating factor in sentencing even if you were prosecuted and convicted of the offense.