DENVER — Brandon Coats knew he was going to fail his drug test. Paralyzed in a car crash when he was 16, he had been using medical marijuana since 2009 to relieve the painful spasms that jolted his body. But he smoked mostly at night, and said marijuana had never hurt his performance answering customer calls for a Colorado satellite-television provider.

So when his employer, Dish Network, asked Mr. Coats to take a random drug screen, he was not surprised when the test came back positive for marijuana. He told his bosses why, but when he got to work the following week, he said, “my card wouldn’t open up the door.” He was fired for violating the company’s drug-free workplace rules, despite having a medical marijuana card.

“There are a lot of people out there who need jobs, can do a good job, but in order for them to live their lives, they have to have this,” said Mr. Coats, who is 35. “A person can drink all night long, be totally hung over the next day and go to work and there’s no problem with it.”

But when it comes to marijuana, Mr. Coats and other users are discovering that marijuana’s recent strides toward the legal and cultural mainstream are running aground at the office. Even as 23 states allow medical or recreational marijuana, employment experts say that most businesses are keeping their drug-free policies. The result is a clash between a culture that increasingly accepts marijuana and companies that will fire employees who use it.