Interface 5v digital pulses to keyboard contacts?
Whether a transistor directly across the contact is a good idea or not depends on how the low side of the switch is configured. If that's just an open-drain/open-collector then there's no problem. If it would have a very weak pull-up then the transistor's emitter will be a few volts positive with respect to the base, and though the voltage may not be high enough to damage the transistor, NPN transistors don't like that.  

A safe alternative is to use an analog switch, 



like the 74LVC1G66, which is an improved single gate version of the good old CD4066 quad switch. The 74LVC1G66 has an on-resistance of less than 10 &Omega;, but at least a few tens of ohms should be no problem.

Many of these switches have near-zero power supply current (typically 100 nA for the 1G66), and contrary to mechanical relays don't wear out.

If you can't connect the heartbeat monitor's power supply to the keyboard's you'll have to use an SSR (Solid State Relay), like Dave suggests in his answer. These are more expensive though: the Toshiba type Dave mentions costs almost 4 times the 1G66, so I would only use that one if you really need the isolation.