Companies facing a shortage of employees from health-care workers to forklift operators are confronting a new challenge: finding candidates who can pass drug tests in states that have legalized marijuana.

Ten states and Washington, D.C., have legalized recreational marijuana use. Lawmakers in Illinois, New Jersey, New York and elsewhere are pushing to do the same. More than 60% of Americans support legalization, according to Pew Research Center, double the rate in 2000.

Marijuana...