Indeed some employers intend to mitigate impaired workers on the job, and naïvely think a drug test is the right tool for the job. In that case, the outcome is not the intent.
Some employers know that testing employees for marijuana is a lifestyle selection tool, and they bluntly admit it's their intent.
Large corporations have a variety of factors in play. There's a marketing factor, such that corporations want to appeal to investors by advertising their zero-tolerance "Drug-Free Workplace" policy. They are betting (perhaps correctly) that significant investors are largely conservatives who will believe the propaganda. At the same time, CEOs and upper management tend to be wealthy elitist types who naturally cling to neoconservative politics themselves. Right-wing employers tend to use of political profiling in their hiring and reduction-in-force practices, even when the job is not political.
IMO the only way to make a dent in this problem is to boycott.