The Ninth U.S. Circuit Court of Appeals, which covers nine Western states including California, Washington and Oregon, ruled the federal ban is not in violation of the Second Amendment.
The states in that region that have legalized or effectively decriminalized medical marijuana include Alaska, Arizona, California, Hawaii, Montana, Nevada, Oregon and Washington.
S. Rowan Wilson, a woman from Nevada, filed a lawsuit when she attempted to buy a firearm in 2011 after she had obtained a medical marijuana card.
She was declined by the gun store because of the federal rule regarding the sale of firearms to illegal drug users; marijuana is illegal under federal law.
Senior District Judge Jed Rakoff said that the ban makes sense because using drugs "raises the risk of irrational or unpredictable behavior with which gun use should not be associated," according to The Associated Press.
The Ninth Circuit Court upheld the ban in a 3-0 decision.