Wal-Mart Stores Inc. violated the rights of a medical marijuana card-holding employee in Arizona by firing her for a positive drug test, a federal judge ruled in an apparent case of first impression.

The Arizona Medical Marijuana Act, like similar laws in others states, allows discrimination suits against employers that take adverse action against a worker based on the lawful use of the drug, the U.S. District Court for the District of Arizona said Feb. 7. It was passed...