I'm going to disagree to a large extent with those posting here. It is undeniable that the statute directly infringes on the First Amendment right of the doctors to discuss matters with their patients. It does not matter if the doctors discuss pure politics and tries to persuade their patients to vote for a candidate whom he or she endorses. That's the nature of free speech. Likewise, asking questions about firearms in the home, which at least is arguably safety related, is free speech. Even if driven by purely political reasons, it would remain protected by the First Amendment. In fact, political speech is given the greatest protection the First Amendment affords. As I understand the statue, it prevents a physician from asking questions about firearms in the home. I have no doubt this will be declared unconstitutional.
The problem here is that First Amendment Rights, just like almost all other rights, are not unlimited. What this is really about is physicians abusing their position of authority in order to further their own political agenda. People get up in arms, and rightly so, about teachers attempting to indoctrinate students with their own political agendas and this really isn't all that dissimilar. Doctors do indeed hold an air of authority, I've seen many people follow rather ridiculous advice simply because it came from a doctor's mouth.
Now, before I'm flamed for attacking doctors, let me say that just like everyone else, there are very good doctors and there are very poor ones. I have a bit of medical background as my stepfather is an MD, my mother is a nurse, and my father is a respiratory therapist while I myself am a nursing student. My stepfather is, I feel, a good physician and his opinion on medical matters carries great weight with me. He himself will tell you, however, that he knows very little about firearms or firearm safety (his only expertise in that area is the treatment of gunshot wounds since he's spent the last several years as an Emergency Room physician) and that he is not qualified to offer authoritative advice on such matters.
As Al Norris pointed out, a physician is only qualified to offer authoritative firearms safety advice if he or she is also a certified firearms safety instructor. I would venture to guess that the vast majority of physicians do not hold such a credential and as such, counselling patients on such matters is, outside of a few very limited circumstances, outside the scope of their practice IMHO.
One of the very first things that I was taught in nursing school is that one of the fastest and surest ways to have your employment terminated and lose your professional license is to operate outside your scope of practice. Medical as well as other licensed professionals have a specific scope of practice for a very good reason: their training is limited to a fairly specific area of expertise. To offer advice outside of what one has been schooled and trained for is a bad idea at best and downright dangerous at worst. Even amongst physicians, scope of practice has its limits. A pulmonologist would not recommend treatment for a GI condition just like a neurologist would not recommend treatment for a cardiovascular condition. Even an internal medicine doctor that treats a broad range of disorders will, if responsible, only take a course of treatment so far without consulting a specialist for that particular type of disorder.
As I said before, no one is attempting to restrict the political rights of physicians. A physician may still belong to whatever political organization he or she wishes to and may exercise his or her First Amendment rights just like anyone else. What a physician should not be able to do, however, is to utilize his position of authority in an attmept to force his political beliefs on others and that is what this law is really about. First Amendment rights are one thing, but exploiting a professional license and the authority that comes with it to further a political agenda is another issue entirely.