No student ought to be put into a situation in which/ where he has to choose between his loyalty to his friends and his duty to the class.
[1]
No student ought to be put in a situation [
in which he has to choose between his loyalty to his friends and his duty to the class ___ ].
[2]
No student ought to be put in a situation [
where he has to choose between his loyalty to his friends and his duty to the class ___].
Leaving aside gender-neutrality and the meaning of the sentence, "in which" and "where" are both fine and have the same meaning.
In [1] "which" is a relative pronoun with "situation" as its antecedent. "Which" functions as complement of "in", and the preposition phrase "in which" then functions as an adjunct in the relative clause.
In [2] "where" is not a pronoun but according to some an adverb, to others a preposition. "Where", just like "in which" in [1], functions as an adjunct in the relative clause.