But IIRC, in time of war, if POWs attempt to escape and they in doing so assault one of their captors (as Kirk and Spock did) then the POWs are subject to reprisals.
On the other hand, if POWs do not attempt to escape, their own superiors charge them with dereliction of duty and whatnot, and quite possibly shoot them after liberation if the jailers haven't gotten around to it.
Rules of war are really meant to get people killed. There's no "nice" way out. And playing by the rules of the enemy seldom pays off.