The Law forbade the Israelites from marrying Canaanites, unless they turned to Yahweh and worshipped Him as the One True God.
God always encouraged Israel to accept foreigners. After all, the Israelites themselves were refugees in Egypt for generations, and “many other people” left Egypt with them.
There are many verses that deal with how Israel was supposed to treat the foreigners among them. Here are just a few from the Law given by Moses: