JC, MD asks that very question.
My response: “Of course.”
Every person has a right to life, which implies that every person has a right to defend his or her life from harm.
One of the principles of a physician is “first, do no harm“. In my (non-medical) opinion, this is limited to the context of practicing medicine. A doctor should not perform treatment that harms his patients. Seems clear enough.
Outside the practice of medicine, this does not apply — a doctor (like anyone else) would be justified in causing harm (by means of the lawful use of force) in legitimate self-defense
I have no problems with doctors possessing guns, as they have just as much right to protect themselves as does anyone else. In fact, I don’t see why this question should be raised at all, as it’s answer is so self-evident.
The only concerns I might have would be technical ones, like having a gun too near an MRI machine
(PDF), resting on a hot autoclave, or other such things. Of course, incidents of that nature are extremely rare (even with non-gun objects), so it’s quite unlikely that it would occur with guns.