Mesorat Hashas sur Horayot 3:7

הָאִישׁ קוֹדֵם לָאִשָּׁה לְהַחֲיוֹת וּלְהָשִׁיב אֲבֵדָה. וְהָאִשָּׁה קוֹדֶמֶת לָאִישׁ לִכְסוּת, וּלְהוֹצִיאָהּ מִבֵּית הַשֶּׁבִי. בִּזְמַן שֶׁשְּׁנֵיהֶם עוֹמְדִים לְקַלְקָלָה, הָאִישׁ קוֹדֵם לָאִשָּׁה:

Si un homme et une femme ont tous les deux besoin d’être nourris, l’homme passe avant la femme; il en est de même si tous les deux ont perdu quelque chose, et qu’il s’agit de savoir s’il faut s’occuper de la chose perdue de l’homme, pour la lui rendre, ou de celle de la femme. Si un homme et une femme ont tous les deux besoins d’être vêtus, ou s’ils sont tous deux prisonniers et qu’il s’agisse de les racheter, la femme passe avant l’homme; si l’homme et la femme sont tous les deux exposés à être violés par l’ennemi, il faut racheter l’homme avant la femme.

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.]