In a prison context, protective custody is used mainly in the following cases:
Protective custody might simply involve putting the person in a secure prison (if the threat is from the outside), but usually protective custody involves some degree of solitary confinement. In the case of a person being threatened due to his association with a certain group, moving that person to another section of the prison may be sufficient.
Protective custody does not necessarily imply a prisoner or a prison setting. In some usages, it might simply involve placing a person in a secure setting, with no implication of imprisonment, such as when a child is placed in temporary foster care. In some cases, non-criminals (or defendants in pending trials) have also been placed in protective custody in a prison setting, for example to protect them from being lynched.
In Nazi Germany, the German equivalent term, 'Schutzhaft', was used as a euphemism for the extra- or para-legal rounding-up of political opponents and especially Jews, sometimes officially defended as being necessary to protect them from the 'righteous' wrath of the German population. The victims were then sent to concentration camps, where most were later exterminated.