A man takes precedence to a woman for (saving of) life and for returning of lost objects, [a man being more sanctified than a woman, being commanded in all of the mitzvoth, while a woman is not commanded in time-oriented positive commandments], and a woman takes precedence to a man for clothing, [her shame being greater than that of a man], and for rescue from captivity. When they are both liable to (sexual) abuse [(rape or sodomy, respectively)], a man takes precedence (for rescue) to a woman, [the act being "natural" for a woman but unnatural for a man].
Tosefta Horayot
A man takes precedence over a woman [in regards to saving] a life and the return of lost property. A woman takes precedence over a man [in regards] to being clothed and to saving from captivity. In a situation that both of them are subjected to degradation, the man takes precedence. It so happened that Rabbi Yehoshua went to Rome. They told him, "There is here a certain child from Jerusalem, with beautiful eyes, and good-looking, who is about to be degraded." Rabbi Yehoshua went to check on him. When he arrived at the entrance [of where the captive was being held], he called out this passage (Is. 42:24): "Who was it who gave Jacob over to despoilment and Israel to plunderers?" (JPS Tr.). The child answered him, and said (ibid.), "Surely, it is God, against whom we sinned." At that very moment, Rabbi Yehoshua said, "I call upon Heaven and earth to stand as witnesses before me, that I will not move from this place until I have redeemed him, no matter how much money it takes." [And indeed] he redeemed him with a great amount of money, and he went to live in the Land of Israel. And about him it is said (Lam. 4:2), "Children of Zion, O precious ones, whose value is as pure gold." [Note: Per Git. 58a:10, this child grew to become Rabbi Yishmael ben Elisha.]