According to the
Catechism of the Catholic Church (1867):
The catechetical tradition also recalls that there are “sins that cry to heaven”:
Among this set of grave social sins in our sacred tradition is "
The cry of the foreigner, the widow, and the orphan", the OT biblical references for which is commonly given as:
Exodus 22:21–24
21 “Do not mistreat a foreigner or oppress him, for you were foreigners in Egypt. 22 “Do not take advantage of a widow or an orphan. 23If you do and they cry out to me, I will certainly hear their cry. 24My anger will be aroused
And the NT reference, of course, being Luke's Parable of the Good Samaritan:
Jesus answered, "A certain man was going down from Jerusalemto Jericho, and he fell among robbers, who both stripped him and beat him, and departed, leaving him half dead. By chance a certain priest was going down that way. When he saw him, he passed by on the other side. In the same way a Levite also, when he came to the place, and saw him, passed by on the other side. But a certain Samaritan, as he travelled, came where he was. When he saw him, he was moved with compassion, came to him, and bound up his wounds, pouring on oil and wine. He set him on his own animal, and brought him to an inn, and took care of him. On the next day, when he departed, he took out two denarii, and gave them to the host, and said to him, 'Take care of him. Whatever you spend beyond that, I will repay you when I return.' Now which of these three do you think seemed to be a neighbour to him who fell among the robbers?"
He said, "He who showed mercy on him."
Then Jesus said to him, "Go and do likewise."
— Luke 10:30–37,
World English Bible
A nice summation of Catholic doctrine on this was made by Pope Pius XII in 1952:
papalencyclicals.net/Pius12/p12exsul.htm
EXSUL FAMILIA NAZARETHANA
Apostolic Constitution of Pius XII, dated August 1, 1952.
You know indeed how preoccupied we have been and with what anxiety we have followed those who have been forced by revolutions in their own countries, or by unemployment or hunger to leave their homes and live in foreign lands.
The natural law itself, no less than devotion to humanity, urges that ways of migration be opened to these people. For the Creator of the universe made all good things primarily for the good of all. Since land everywhere offers the possibility of supporting a large number of people, the sovereignty of the State, although it must be respected, cannot be exaggerated to the point that access to this land is, for inadequate or unjustified reasons, denied to needy and decent people from other nations, provided of course, that the public wealth, considered very carefully, does not forbid this.