the key are the so called mirror neurons. they make you actually feel the pains you see. they fire not only when you do a task, but also when you watch others doing the task.
http://en.wikipedia.org/wiki/Mirror_neuron
also a lot of what we call empathy and personality seem to be part of the prefrontal cortex. it is well described that so called psychopaths or pathological narcists have less activity in that region of the brain.
and if i remember correctly empathy can also be trained and learned.