Many different laws apply to this question, and they broadly prohibit employers from requiring any payments from an applicant (or employee) as a condition to his/her obtaining or continuing employment.
Indeed, employers cannot require that prospective employees pay for any type of medical examination or physical examination. Nor can this payment be made as a withholding from future paychecks.
California's constitutional right to privacy places limits on employer drug testing. Generally, post-offer/pre-employment drug testing is allowed. However, the cost should not be passed on to the applicant.
In addition to the state laws prohibiting passing on the cost to the applicant, requiring an applicant to pay for a pre-employment drug test might have the effect of discouraging some applicants, or else effectively result in less than minimum wage for the employee’s first paycheck.
The California Labor Commissioner has addressed cases where an employer charged prospective applicants a fee to attend and perform at a “workshop” to apply for a job. That process was rejected by the Labor Commissioner as violating Labor Code Section 450, which states: “No employer…may compel or coerce any employee, or applicant for employment, to patronize his or her employer, or any other person, in the purchase of anything of value.”