Facultative homosexuality (dictionary)
From BoyWiki
Facultative Homosexuality" describes a man who lies more towards the heterosexual side of the sexual continuum who does have some same-sex desire and who engages in homosexual sex and behavior while in prison only. After he is released from jail he returns to a heterosexual lifestyle.
The same-sex physical activity may be engaged in only for sexual release, power, or control, or in situations where there are no members of the opposite sex, such as in a prison.