Horayot 3:7 Halakha : Mishneh Torah, Gifts to the Poor & Shulchan Arukh, Yoreh De'ah

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

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.

Mishneh Torah, Gifts to the Poor

A woman takes precedence over a man for feeding, clothing, and bringing out of prison, because it is more usual for men to go door to door [to beg] and not for a woman who feels great shame in this. But if both of them [a man and a woman] were in captivity and were in danger of being violated sexually, the man takes precedence for redemption, because this is not the way of things.158See Mishnah Horayot 3:7, Babylonian Talmud Ketubot 67a.

Shulchan Arukh, Yoreh De'ah

A woman is redeemed before a man; but where pederasty is common, the man is given precedence. (If both are willing to drown, the man is rescued first.)