Doctors and nurses see people at their worst and in their most vulnerable state. That coupled with their professionalism probably means they take a different view to people in their underwear than maybe most people would - regardless of what kind of underwear that might be!
Obviously they're still human beings, and as such still susceptible to all the thoughts and desires that come biologically and psychologically with being a human - but I'd like to think their professionalism and conditioning helps them manage that side of things, and focus instead on their job.
On the other hand, having watched a few medical dramas (I'm afraid that's about as far as my medical knowledge spans), it does seem that they enjoy having a bit of 'banter' between each other, and maybe discussing a patient's unusual undergarments might be a way of letting off steam for them.
Either way, if you end up in hospital in a state that requires medics to remove your clothes, I have a feeling what kind of undergarments you are wearing might be the least of your worries!