The plaintiffs in the case plan to ask for a full "en banc" hearing by the 11th Circuit U.S. Court of Appeals in Atlanta. The court, in a 2-1 decision Friday, reversed a lower court ruling that the law is unconstitutional.
Gov. Rick Scott signed the bill, the Firearm Owners' Protection Act, in 2011.
Writing for the court majority, Judge Gerald Tjoflat agreed with the state's argument that the law requires doctors to practice good medical care.
"The Act simply informs physicians that inquiring about a private matter irrelevant to medical care isn't part of the practice of good medicine and that, as always, a physician may face discipline for not practicing good medicine," he wrote.
Critics point out that doctors are free to ask patients about their sex lives and other deeply personal matters. But they cannot ask them how they store guns unless it is "relevant."
"Counseling the patients we care for helps prevent gun-related injuries and deaths, with studies showing that patients who received physician counseling on firearm safety were more likely to adopt one or more safe gun-storage practices," Dr. Robert Wah, president of the American Medical Association, said in a statement.
"The political interests of state lawmakers do not justify infringing on the patient-physician relationship and stifling relevant medical discussions that are proven to save lives."
The National Rifle Association, which lobbied for the bill, took a different view of the decision.
"It is not a physician's business whether his or her patient chooses to exercise their fundamental, individual right to own a firearm," said Chris Cox, executive director of the NRA's Institute for Legislative Action.