You took this out of context. These commands are directed at Jews, who were slaves in Egypt. Christians were never slaves in Egypt.
God’s Heart for the Foreigner
God’s heart for the foreigner is stated clearly throughout Scripture. Often, we allow politics or public opinion to form our convictions about
immigrants,
refugees,
international students, and other foreigners living among us. We must let the Word of God, rather than society or personal prejudices, determine our attitudes and actions towards outsiders. Depending on your Bible translation, we read that God repeatedly commanded His people to love, serve, provide for, and share His Word with the “aliens,” “sojourners,” “foreigners,” or “strangers” living among them.
Here are some key passages from the book of Deuteronomy concerning God’s people and the foreigners living among them.
Deut. 10:17-19 For the LORD your God is God of gods and Lord of lords, the great God, mighty and awesome, who shows no partiality and accepts no bribes. He defends the cause of the fatherless and the widow, and loves the alien, giving him food and clothing. And you are to love those who are aliens, for you yourselves were aliens in Egypt.
Deut. 24:17-18 Do not deprive the alien or the fatherless of justice, or take the cloak of the widow as a pledge. Remember that you were slaves in Egypt and the LORD your God redeemed you from there. That is why I command you to do this.
Deut. 14:28-29 At the end of every three years, bring all the tithes of that year’s produce and store it in your towns, so that the Levites (who have no allotment or inheritance of their own) and the aliens, the fatherless and the widows who live in your towns may come and eat and be satisfied, and SO THAT the LORD your God may bless you in all the work of your hands.
Deut. 31:10-13 Then Moses commanded them: “At the end of every seven years, in the year for canceling debts, during the Feast of Tabernacles, when all Israel comes to appear before the LORD your God at the place he will choose, you shall read this law before them in their hearing. Assemble the people, men, women and children, and the aliens living in your towns, so they can listen and learn to fear the LORD your God and follow carefully all the words of this law. Their children, who do not know this law, must hear it and learn to fear the LORD your God as long as you live in the land you are crossing the Jordan to possess.”
Deut. 24:21-22 When you harvest the grapes in your vineyard, do not go over the vines again. Leave what remains for the alien, the fatherless and the widow. Remember that you were slaves in Egypt. That is why I command you to do this.