Companies drug test for one reason, insurance. Insurance companies force them too. A lot of big companies only test you, once hired, if you are involved in an accident. Again, insurance calls the shots. If the substance were legalized, federally, companies could not request you be tested for it any more than they can for alcohol. Only something as artificially over hyped as the war on drugs can override your right to privacy in terms of your medical condition.
Companies in Cali can still legally test you, even when you are prescribed, because federal law states its an illegal substance that can be tested for legally. Its fall out from the discrepancies between state and federal law, and each govt branch's attempt at wielding power over the other. Ever seen a raid on a legal dispensary in California? Federal agents rush into this state-approved 'legal' place of business, escort employees out, some taken to jail, computers seized, files taken... while the state cops stand outside holding back the angry crowd and stating there's nothing they can do to interfere. This 'legal' business is treated like a crack house. It'll be closed a few weeks at most, and then open back up for business, just waiting for the feds to do it again in a few months. Its a legal 'boundary' between state and federal rights/power, and it plays out quite dramatically stupid.