What is the term for someone who causes/allows themselves to experience a similar pain to someone else as a way of empathizing with them or making it up to them? For example a person witnesses the assault of another person, and allows the assaulted person to attack them without resistance; as a way of making it right for the initially assaulted person? I believe there is a medical term for this, but I am not sure.
What about a phantom pregnancy in a man, also called a sympathetic pregnancy, when the husband of a pregnant wife, or the male partner of a pregnant female partner, experiences many of the clinical symptoms of his pregnant other-half. Case studies of "expectant" fathers have identified morning sickness, food cravings, back pain, fatigue, labor pains and in very rare cases, a swollen stomach resembling a 'baby bump'. The condition is also known as Couvade Syndrome but many medical professionals do not recognize it. (BBC News)
You may be looking for the term Munchausen's syndrome Munchausen's
Munchausen syndrome is a factitious disorder wherein those affected feign disease, illness, or psychological trauma to draw attention, sympathy, or reassurance to themselves.
The perpetrators can also inflict disease on those for whom they are caregivers.
It doesn't quite fit your definition, where the person is supposedly doing this out of empathy.
If you want further information on up-to-date terminology, there's DSM-5-- Diagnostic and Statistical Manual of Mental Disorders