In Bava Metzia 59b, R' Eliezer mentions 36 times the Tanakh warns us against mistreating the גר and other Sages say 46 times.
Note on translation: There are many possible translations for the Biblical Hebrew גר (ger) which usually refers to one of foreign birth or nationality that lives among those of a different nationality. Common translations include "sojourner, stranger, alien, and resident alien." Since the root of the word indicates temporariness of stay and any type of permanent stay is made explicit by the usage of גר תושב (ger toshav, the resident ger or resident alien) or some form of הגר הגר אתכם (ha-ger ha-gar itkhem, the ger who lives among you), the word sojourner seems most accurate of the bunch.
However, in its modern usage, the word sojourner now sounds antiquated and, perhaps more importantly, it has lost its stigma. The גר is stigmatized; the גר is as vulnerable to abuse as the widow and the fatherless. With that in mind, these text translate גר as migrant (a term familiar to those of us who know of the struggle and oppression of the migrant worker) and גר תושב and different forms of הגר הגר אתכם as immigrant - the one who has migrated to live among us.
These translations are not perfect. Most notably, the גר may actually be children or descendants of migrants or immigrants. The need to preserve the sense of stigma the גר faces in society outweighs the option to use a different translation.
1. You Were a Stranger Too
Within Jewish law, few tenets are repeated as much as the following. This tenet is repeated no less than 36 times in the Torah.
(כ) וְגֵ֥ר לֹא־תוֹנֶ֖ה וְלֹ֣א תִלְחָצֶ֑נּוּ כִּֽי־גֵרִ֥ים הֱיִיתֶ֖ם בְּאֶ֥רֶץ מִצְרָֽיִם׃
(20) You shall not wrong or oppress a stranger, for you were strangers in the land of Egypt.
(ט) וְגֵ֖ר לֹ֣א תִלְחָ֑ץ וְאַתֶּ֗ם יְדַעְתֶּם֙ אֶת־נֶ֣פֶשׁ הַגֵּ֔ר כִּֽי־גֵרִ֥ים הֱיִיתֶ֖ם בְּאֶ֥רֶץ מִצְרָֽיִם׃
(9) You shall not oppress a stranger, for you know the feelings of the stranger, having yourselves been strangers in the land of Egypt.
(לג) וְכִֽי־יָג֧וּר אִתְּךָ֛ גֵּ֖ר בְּאַרְצְכֶ֑ם לֹ֥א תוֹנ֖וּ אֹתֽוֹ׃(לד) כְּאֶזְרָ֣ח מִכֶּם֩ יִהְיֶ֨ה לָכֶ֜ם הַגֵּ֣ר ׀ הַגָּ֣ר אִתְּכֶ֗ם וְאָהַבְתָּ֥ לוֹ֙ כָּמ֔וֹךָ כִּֽי־גֵרִ֥ים הֱיִיתֶ֖ם בְּאֶ֣רֶץ מִצְרָ֑יִם אֲנִ֖י יהוה אֱלֹהֵיכֶֽם׃
(33) When strangers reside with you in your land, you shall not wrong them.(34) The strangers who reside with you shall be to you as your citizens; you shall love each one as yourself, for you were strangers in the land of Egypt: I יהוה am your God.
(יט) וַאֲהַבְתֶּ֖ם אֶת־הַגֵּ֑ר כִּֽי־גֵרִ֥ים הֱיִיתֶ֖ם בְּאֶ֥רֶץ מִצְרָֽיִם׃
(19) You too must befriend the stranger, for you were strangers in the land of Egypt.
"On the Refugee Crisis" by Rabbi Lord Jonathan Sacks (2015)
I used to think that the most important line in the Bible was “Love your neighbour as yourself”. Then I realised that it is easy to love your neighbour because he or she is usually quite like yourself. What is hard is to love the stranger, one whose colour, culture or creed is different from yours. That is why the command, “Love the stranger because you were once strangers”, resonates so often throughout the Bible. It is summoning us now. A bold act of collective generosity will show that the world, particularly Europe, has learned the lesson of its own dark past and is willing to take a global lead in building a more hopeful future. Wars that cannot be won by weapons can sometimes be won by the sheer power of acts of humanitarian generosity to inspire the young to choose the way of peace instead of holy war.
2. Equal Treatment, Regardless of Citizenship Status
(יד) וְכִֽי־יָגוּר֩ אִתְּכֶ֨ם גֵּ֜ר א֤וֹ אֲשֶׁר־בְּתֽוֹכְכֶם֙ לְדֹרֹ֣תֵיכֶ֔ם וְעָשָׂ֛ה אִשֵּׁ֥ה רֵֽיחַ־נִיחֹ֖חַ לַיהוה כַּאֲשֶׁ֥ר תַּעֲשׂ֖וּ כֵּ֥ן יַעֲשֶֽׂה׃(טו) הַקָּהָ֕ל חֻקָּ֥ה אַחַ֛ת לָכֶ֖ם וְלַגֵּ֣ר הַגָּ֑ר חֻקַּ֤ת עוֹלָם֙ לְדֹרֹ֣תֵיכֶ֔ם כָּכֶ֛ם כַּגֵּ֥ר יִהְיֶ֖ה לִפְנֵ֥י יהוה׃(טז) תּוֹרָ֥ה אַחַ֛ת וּמִשְׁפָּ֥ט אֶחָ֖ד יִהְיֶ֣ה לָכֶ֑ם וְלַגֵּ֖ר הַגָּ֥ר אִתְּכֶֽם׃ {פ}
(14) And when, throughout the ages, a stranger who has taken up residence with you, or one who lives among you, would present an offering by fire of pleasing odor to יהוה —as you do, so shall it be done by(15) the rest of the congregation. There shall be one law for you and for the resident stranger; it shall be a law for all time throughout the ages. You and the stranger shall be alike before יהוה;(16) the same ritual and the same rule shall apply to you and to the stranger who resides among you.
(מט) תּוֹרָ֣ה אַחַ֔ת יִהְיֶ֖ה לָֽאֶזְרָ֑ח וְלַגֵּ֖ר הַגָּ֥ר בְּתוֹכְכֶֽם׃
(49) There shall be one law for the citizen and for the stranger who dwells among you.
3. Offering Assistance to Refugees
(טז) וָאֲצַוֶּה֙ אֶת־שֹׁ֣פְטֵיכֶ֔ם בָּעֵ֥ת הַהִ֖וא לֵאמֹ֑ר שָׁמֹ֤עַ בֵּין־אֲחֵיכֶם֙ וּשְׁפַטְתֶּ֣ם צֶ֔דֶק בֵּֽין־אִ֥ישׁ וּבֵין־אָחִ֖יו וּבֵ֥ין גֵּרֽוֹ׃(יז) לֹֽא־תַכִּ֨ירוּ פָנִ֜ים בַּמִּשְׁפָּ֗ט כַּקָּטֹ֤ן כַּגָּדֹל֙ תִּשְׁמָע֔וּן לֹ֤א תָג֙וּרוּ֙ מִפְּנֵי־אִ֔ישׁ כִּ֥י הַמִּשְׁפָּ֖ט לֵאלֹהִ֣ים ה֑וּא וְהַדָּבָר֙ אֲשֶׁ֣ר יִקְשֶׁ֣ה מִכֶּ֔ם תַּקְרִב֥וּן אֵלַ֖י וּשְׁמַעְתִּֽיו׃
(16) I charged your magistrates at that time as follows, “Hear out your fellow Israelites, and decide justly between one party and the other—be it a fellow Israelite or a stranger.(17) You shall not be partial in judgment: hear out low and high alike. Fear neither party, for judgment is God’s. And any matter that is too difficult for you, you shall bring to me and I will hear it.”
(כח) מִקְצֵ֣ה ׀ שָׁלֹ֣שׁ שָׁנִ֗ים תּוֹצִיא֙ אֶת־כׇּל־מַעְשַׂר֙ תְּבוּאָ֣תְךָ֔ בַּשָּׁנָ֖ה הַהִ֑וא וְהִנַּחְתָּ֖ בִּשְׁעָרֶֽיךָ׃(כט) וּבָ֣א הַלֵּוִ֡י כִּ֣י אֵֽין־לוֹ֩ חֵ֨לֶק וְנַחֲלָ֜ה עִמָּ֗ךְ וְ֠הַגֵּ֠ר וְהַיָּת֤וֹם וְהָֽאַלְמָנָה֙ אֲשֶׁ֣ר בִּשְׁעָרֶ֔יךָ וְאָכְל֖וּ וְשָׂבֵ֑עוּ לְמַ֤עַן יְבָרֶכְךָ֙ יהוה אֱלֹהֶ֔יךָ בְּכׇל־מַעֲשֵׂ֥ה יָדְךָ֖ אֲשֶׁ֥ר תַּעֲשֶֽׂה׃ {ס}
(28) Every third year you shall bring out the full tithe of your yield of that year, but leave it within your settlements.(29) Then the [family of the] Levite, who has no hereditary portion as you have, and the stranger, the fatherless, and the widow in your settlements shall come and eat their fill, so that your God יהוה may bless you in all the enterprises you undertake.
(יד) וְשָׂמַחְתָּ֖ בְּחַגֶּ֑ךָ אַתָּ֨ה וּבִנְךָ֤ וּבִתֶּ֙ךָ֙ וְעַבְדְּךָ֣ וַאֲמָתֶ֔ךָ וְהַלֵּוִ֗י וְהַגֵּ֛ר וְהַיָּת֥וֹם וְהָאַלְמָנָ֖ה אֲשֶׁ֥ר בִּשְׁעָרֶֽיךָ׃
(14) You shall rejoice in your festival, with your son and daughter, your male and female slave, the [family of the] Levite, the stranger, the fatherless, and the widow in your communities.
(יד) לֹא־תַעֲשֹׁ֥ק שָׂכִ֖יר עָנִ֣י וְאֶבְי֑וֹן מֵאַחֶ֕יךָ א֧וֹ מִגֵּרְךָ֛ אֲשֶׁ֥ר בְּאַרְצְךָ֖ בִּשְׁעָרֶֽיךָ׃
(14) You shall not abuse a needy and destitute laborer, whether a fellow Israelite or a stranger in one of the communities of your land.
(יז) לֹ֣א תַטֶּ֔ה מִשְׁפַּ֖ט גֵּ֣ר יָת֑וֹם וְלֹ֣א תַחֲבֹ֔ל בֶּ֖גֶד אַלְמָנָֽה׃
(17) You shall not subvert the rights of the stranger or the fatherless; you shall not take a widow’s garment in pawn.
(כ) כִּ֤י תַחְבֹּט֙ זֵֽיתְךָ֔ לֹ֥א תְפַאֵ֖ר אַחֲרֶ֑יךָ לַגֵּ֛ר לַיָּת֥וֹם וְלָאַלְמָנָ֖ה יִהְיֶֽה׃(כא) כִּ֤י תִבְצֹר֙ כַּרְמְךָ֔ לֹ֥א תְעוֹלֵ֖ל אַחֲרֶ֑יךָ לַגֵּ֛ר לַיָּת֥וֹם וְלָאַלְמָנָ֖ה יִהְיֶֽה׃
(20) When you beat down the fruit of your olive trees, do not go over them again; that shall go to the stranger, the fatherless, and the widow.(21) When you gather the grapes of your vineyard, do not pick it over again; that shall go to the stranger, the fatherless, and the widow.
(יא) וְשָׂמַחְתָּ֣ בְכׇל־הַטּ֗וֹב אֲשֶׁ֧ר נָֽתַן־לְךָ֛ יהוה אֱלֹהֶ֖יךָ וּלְבֵיתֶ֑ךָ אַתָּה֙ וְהַלֵּוִ֔י וְהַגֵּ֖ר אֲשֶׁ֥ר בְּקִרְבֶּֽךָ׃ {ס}(יב) כִּ֣י תְכַלֶּ֞ה לַ֠עְשֵׂ֠ר אֶת־כׇּל־מַעְשַׂ֧ר תְּבוּאָתְךָ֛ בַּשָּׁנָ֥ה הַשְּׁלִישִׁ֖ת שְׁנַ֣ת הַֽמַּעֲשֵׂ֑ר וְנָתַתָּ֣ה לַלֵּוִ֗י לַגֵּר֙ לַיָּת֣וֹם וְלָֽאַלְמָנָ֔ה וְאָכְל֥וּ בִשְׁעָרֶ֖יךָ וְשָׂבֵֽעוּ׃(יג) וְאָמַרְתָּ֡ לִפְנֵי֩ יהוה אֱלֹהֶ֜יךָ בִּעַ֧רְתִּי הַקֹּ֣דֶשׁ מִן־הַבַּ֗יִת וְגַ֨ם נְתַתִּ֤יו לַלֵּוִי֙ וְלַגֵּר֙ לַיָּת֣וֹם וְלָאַלְמָנָ֔ה כְּכׇל־מִצְוָתְךָ֖ אֲשֶׁ֣ר צִוִּיתָ֑נִי לֹֽא־עָבַ֥רְתִּי מִמִּצְוֺתֶ֖יךָ וְלֹ֥א שָׁכָֽחְתִּי׃
(11) And you shall enjoy, together with the [family of the] Levite and the stranger in your midst, all the bounty that your God יהוה has bestowed upon you and your household.(12) When you have set aside in full the tenth part of your yield—in the third year, the year of the tithe —and have given it to the [family of the] Levite, the stranger, the fatherless, and the widow, that they may eat their fill in your settlements,(13) you shall declare before your God יהוה: “I have cleared out the consecrated portion from the house; and I have given it to the [family of the] Levite, the stranger, the fatherless, and the widow, just as You commanded me; I have neither transgressed nor neglected any of Your commandments:
4. Refugee Aid
(יט) אָר֗וּר מַטֶּ֛ה מִשְׁפַּ֥ט גֵּר־יָת֖וֹם וְאַלְמָנָ֑ה וְאָמַ֥ר כׇּל־הָעָ֖ם אָמֵֽן׃
(19) Cursed be the one who subverts the rights of the stranger, the fatherless, and the widow.—And all the people shall say, Amen.
(ג) כֹּ֣ה ׀ אָמַ֣ר יהוה עֲשׂ֤וּ מִשְׁפָּט֙ וּצְדָקָ֔ה וְהַצִּ֥ילוּ גָז֖וּל מִיַּ֣ד עָשׁ֑וֹק וְגֵר֩ יָת֨וֹם וְאַלְמָנָ֤ה אַל־תֹּנוּ֙ אַל־תַּחְמֹ֔סוּ וְדָ֣ם נָקִ֔י אַֽל־תִּשְׁפְּכ֖וּ בַּמָּק֥וֹם הַזֶּֽה׃
(3) Thus said the LORD: Do what is just and right; rescue from the defrauder him who is robbed; do not wrong the stranger, the fatherless, and the widow; commit no lawless act, and do not shed the blood of the innocent in this place.
(כג) וְהָיָ֣ה בַשֵּׁ֔בֶט אֲשֶׁר־גָּ֥ר הַגֵּ֖ר אִתּ֑וֹ שָׁ֚ם תִּתְּנ֣וּ נַחֲלָת֔וֹ נְאֻ֖ם אדני יהוה׃ {פ}
(23) You shall give the stranger an allotment within the tribe where he resides—declares the Lord GOD.
(י) וְאַלְמָנָ֧ה וְיָת֛וֹם גֵּ֥ר וְעָנִ֖י אַֽל־תַּעֲשֹׁ֑קוּ וְרָעַת֙ אִ֣ישׁ אָחִ֔יו אַֽל־תַּחְשְׁב֖וּ בִּלְבַבְכֶֽם׃
(10) Do not defraud the widow, the orphan, the stranger, and the poor; and do not plot evil against one another.—
The Israelites receive punishment from G-d when they unfairly treat migrants.
(ו) הִנֵּה֙ נְשִׂיאֵ֣י יִשְׂרָאֵ֔ל אִ֥ישׁ לִזְרֹע֖וֹ הָ֣יוּ בָ֑ךְ לְמַ֖עַן שְׁפׇךְ־דָּֽם׃(ז) אָ֤ב וָאֵם֙ הֵקַ֣לּוּ בָ֔ךְ לַגֵּ֛ר עָשׂ֥וּ בַעֹ֖שֶׁק בְּתוֹכֵ֑ךְ יָת֥וֹם וְאַלְמָנָ֖ה ה֥וֹנוּ בָֽךְ׃
(6) Every one of the princes of Israel in your midst used his strength for the shedding of blood.(7) Fathers and mothers have been humiliated within you; strangers have been cheated in your midst; orphans and widows have been wronged within you.
(כט) עַ֤ם הָאָ֙רֶץ֙ עָ֣שְׁקוּ עֹ֔שֶׁק וְגָזְל֖וּ גָּזֵ֑ל וְעָנִ֤י וְאֶבְיוֹן֙ הוֹנ֔וּ וְאֶת־הַגֵּ֥ר עָשְׁק֖וּ בְּלֹ֥א מִשְׁפָּֽט׃
(29) And the people of the land have practiced fraud and committed robbery; they have wronged the poor and needy, have defrauded the stranger without redress.
(ה) וְקָרַבְתִּ֣י אֲלֵיכֶם֮ לַמִּשְׁפָּט֒ וְהָיִ֣יתִי ׀ עֵ֣ד מְמַהֵ֗ר בַּֽמְכַשְּׁפִים֙ וּבַמְנָ֣אֲפִ֔ים וּבַנִּשְׁבָּעִ֖ים לַשָּׁ֑קֶר וּבְעֹשְׁקֵ֣י שְׂכַר־שָׂ֠כִ֠יר אַלְמָנָ֨ה וְיָת֤וֹם וּמַטֵּי־גֵר֙ וְלֹ֣א יְרֵא֔וּנִי אָמַ֖ר יהוה צְבָאֽוֹת׃
(5) But [first] I will step forward to contend against you, and I will act as a relentless accuser against those who have no fear of Me: Who practice sorcery, who commit adultery, who swear falsely, who cheat laborers of their hire, and who subvert [the cause of] the widow, orphan, and stranger, said the LORD of Hosts.
5. Migrants as Voices in the Torah
(יג) שִׁ֥מְעָֽה תְפִלָּתִ֨י ׀ יהוה וְשַׁוְעָתִ֨י ׀ הַאֲזִינָה֮ אֶֽל־דִּמְעָתִ֗י אַֽל־תֶּ֫חֱרַ֥שׁ כִּ֤י גֵ֣ר אָנֹכִ֣י עִמָּ֑ךְ תּ֝וֹשָׁ֗ב כְּכׇל־אֲבוֹתָֽי׃
(13) Hear my prayer, O LORD;
give ear to my cry;
do not disregard my tears;
for like all my forebears
I am an immigrant, resident with You.
give ear to my cry;
do not disregard my tears;
for like all my forebears
I am an immigrant, resident with You.
(ג) עַד־מָתַ֖י רְשָׁעִ֥ים ׀ יהוה עַד־מָ֝תַ֗י רְשָׁעִ֥ים יַעֲלֹֽזוּ׃(ד) יַבִּ֣יעוּ יְדַבְּר֣וּ עָתָ֑ק יִ֝תְאַמְּר֗וּ כׇּל־פֹּ֥עֲלֵי אָֽוֶן׃(ה) עַמְּךָ֣ יהוה יְדַכְּא֑וּ וְֽנַחֲלָתְךָ֥ יְעַנּֽוּ׃(ו) אַלְמָנָ֣ה וְגֵ֣ר יַהֲרֹ֑גוּ וִ֖יתוֹמִ֣ים יְרַצֵּֽחוּ׃
(3) How long shall the wicked, O LORD,
how long shall the wicked exult,(4) shall they utter insolent speech,
shall all evildoers vaunt themselves?(5) They crush Your people, O LORD,
they afflict Your very own;(6) they kill the widow and the migrant;
they murder the fatherless,
how long shall the wicked exult,(4) shall they utter insolent speech,
shall all evildoers vaunt themselves?(5) They crush Your people, O LORD,
they afflict Your very own;(6) they kill the widow and the migrant;
they murder the fatherless,
(ט) יהוה ׀ שֹׁ֘מֵ֤ר אֶת־גֵּרִ֗ים יָת֣וֹם וְאַלְמָנָ֣ה יְעוֹדֵ֑ד וְדֶ֖רֶךְ רְשָׁעִ֣ים יְעַוֵּֽת׃
(9) The LORD watches over the migrant;
He gives courage to the orphan and widow,
but makes the path of the wicked tortuous.
He gives courage to the orphan and widow,
but makes the path of the wicked tortuous.
6. Treating the Stranger
(לב) בַּ֭חוּץ לֹא־יָלִ֣ין גֵּ֑ר דְּ֝לָתַ֗י לָאֹ֥רַח אֶפְתָּֽח׃
(32) No sojourner spent the night in the open;
I opened my doors to the road.
I opened my doors to the road.
Mishpatim: Loving the Stranger, Rabbi Lord Jonathan Sacks (2008)
To be a Jew is to be a stranger. It is hard to avoid the conclusion that this is why Abraham is commanded to leave land, home and father’s house; why, long before Joseph was born, Abraham was already told that his descendants would be “strangers in a land not their own”; why Moses had to suffer personal exile before assuming leadership of the people; why the Israelites underwent persecution before inheriting their own land; and why the Torah is so insistent that this experience – the retelling of the story on Pesach, along with the never-forgotten taste of the bread of affliction and the bitter herbs of slavery – should become a permanent part of their collective memory.
It is terrifying in retrospect to grasp how seriously the Torah took the phenomenon of xenophobia, hatred of the stranger. It is as if the Torah were saying with the utmost clarity: reason is insufficient. Sympathy is inadequate. Only the force of history and memory is strong enough to form a counterweight to hate.
Why should you not hate the stranger? – asks the Torah. Because you once stood where he stands now. You know the heart of the stranger because you were once a stranger in the land of Egypt. If you are human, so is he. If he is less than human, so are you. You must fight the hatred in your heart as I once fought the greatest ruler and the strongest empire in the ancient world on your behalf. I made you into the world’s archetypal strangers so that you would fight for the rights of strangers – for your own and those of others, wherever they are, whoever they are, whatever the color of their skin or the nature of their culture, because though they are not in your image – says G-d – they are nonetheless in Mine. There is only one reply strong enough to answer the question: Why should I not hate the stranger? Because the stranger is me.