This is an interesting question without much historical background. This sub requires historical evidence prior to 1998 in its answers. There is not a lot from before 1998 on this topic. You may want to post somewhere else.
With that being said, the answer is three fold.
Drug testing in the workplace really began with the onset of the drug war. President Reagan began requiring drug testing for federal employees in 1986. Large companies immediately followed suit. As the drug war heated up, workplace testing did too. By the late 1990s employers started to question the cost/benefit of drug testing. Numerous studies— namely one done by the ACLU— revealed that marijuana use isn’t actually a signal of poor performance. At least not more so than the legal drug, alcohol. This supported the experience of the employers themselves who were spending significant sums of money to have the testing done. It still exists today for the reasons mentioned above.