Because it’s none of their damn business. From WTSP:

A Florida law that restricts doctors from discussing gun ownership with their patients is a “legitimate regulation of professional conduct,” a federal appeals court ruled on Friday.

The Firearm Owners Privacy Act prohibited doctors from asking patients about their ownership or recording that information in medical records unless it was medically necessary. The law that passed in 2011 was declared unconstitutional by U.S. District Judge Marcia Cooke, who agreed with doctors and gun control advocates that it violated the free speech rights of Florida physicians.

The 11th U.S. Circuit Court of Appeals in Atlanta overturned that decision. A federal judge in Miami had also blocked the state from enforcing the law.

It should be noted that the law would NOT have — to use an example — prevented psychiatrists from asking a patient about firearms ownership if they thought the patient might be a danger to themselves or others.