In the original sense, a victim was an animal or human which was slain and offered as sacrifice, usually in a religious rite. From Latin victima, sacrificial animal.
However, the term victim is normally not used when the suffering is a legal punishment, such as judicial, prison, military, school or domestic punishment, although such punishment is generally nonconsensual; instead a term such as delinquent is used because "victim", in a way, implies that the person suffers injustice. If that implication is intended however, the term victim is used, e.g. when a form of punishment is considered inappropriate, overly cruel or torture.
When the suffering is consensual (e.g. in BDSM), the term victim is normally not used because it implies nonconsensuality. Exceptions are ironic/humorous usage (e.g. "I want to be the next victim!"), or in forms of play in which the connotations of nonconsensuality are intended (e.g. playing "gangster and victim" or "torturer and victim").