Bible is clear on helping immigrants
Pharaoh invited Joseph`s father and family to cross the border LEGALLY into Egypt.
Gen 45-17
“Now when the news was heard in Pharaoh’s house that Joseph’s brothers had come, it pleased Pharaoh and his servants. 17Then Pharaoh said to Joseph, “Say to your brothers, ‘Do this: load your beasts and go to the land of Canaan, 18and take your father and your households and come to me, and I will give you the best of the land of Egypt and you will eat the fat of the land.’
I wouldn’t use that passage as a base theological tentpole as to how to approach immigration. Pharoah invited a family, not a whole race of genetically related people to Jacob and Joseph in the numbers of thousands who would come in and overwhelm Egypt’s economy. Pharoah wouldn’t have known that over 400 years, this “family” would stay more to themselves and not integrate into Egyptian society, growing into nearly 3 million souls(600000 warrior aged men not counting families and children).
The Egyptians got more out of them economically keeping them enslaved, but they also feared them as a security risk and tried to limit their numbers passing laws enforcing infanticide of their 1st born.