How are the "medical communication" headset sockets on some airliners used? I was recently on a flight during which a passenger had a medical emergency.  The passenger vomited and was reportedly unconscious.

The aircraft was either a Boeing 737-700 or 737-800.  I'm pretty sure it was the 800.  It had pretty blue lighting on the interior ceiling, including oval illuminated cutaways.

Located above one row of seats were two ports marked "Medical Communications" (or something like that).

During the emergency, one of the flight attendants connected a wired headset to these ports in order to communicate with others.

With whom was he likely speaking?

As an aside, the system was poorly designed.  One ports was black and the other gray; both ports otherwise looked identical and were the same size; the colors of the headphone connectors did not match the ports.  Both ports were required to make it functional.  The flight attendant had to try multiple times to get the correct wires into the correct ports.  I had to help the flight attendant get it connected properly.  Such a simple and important issue to fix.

Bonus question: Given that the multiple ports did not appear to be for redundancy, why was such a time-critical system not designed with a single port?
I'm going to assume you're talking about something like this:


Photo liberally stolen from here.

As other have mentioned, these are generally connections for a standard aviation headset (headphone and microphone plugs). When plugged in you're typically connected to the cockpit (so the pilots know what's going on), and on commercial airlines you may also be patched in to a medical consulting service via radio.  

The principle behind this is similar to the early paramedic programs in the United States: Personnel with some basic training (like flight attendants) are connected to a doctor. They describe the patient's condition and symptoms, and the doctor advises on a course of treatment, which can begin immediately and hopefully give the patient a better chance of survival.

The radio patch can also be used by a doctor onboard the aircraft to consult with other physicians and to help the flight crew arrange for appropriate transport services to meet the plane when it lands.