The company could legally make it a requirement of working for it. If the contract or agreement (including any oral agreement, if there is nothing in writing) between the company and the contractor is such that he or she is not guarantied work (whether for a certain amount of time, or for a given project, or to a certain dollar amount, etc.), but rather, the company may decide when, whether, and how much work to give him or her, the company could require the contractor to get a drug test. If he or she does not, the company could then stop employing hm or her.