The Talmud (Tractate Gittin 57:2) distinguishes between ger tzedek (a ‘righteous alien’)—a foreigner who has fully converted (i.e. accepted the teachings of the Torah) and ‘is a Jew to all intents and purposes’, and a ger toshav (‘resident alien’), who has merely joined the community and has accepted the Noahide commandments.
However, in biblical times this distinction was not made, and foreigners/non-Israelites were frequently absorbed into the community by merely swearing allegiance, i.e., tying their fate with that of the nation. Ruth’s vow (Ruth 1:16) is typical:
Intreat me not to leave thee, or to return from following after thee: for whither thou goest, I will go; and where thou lodgest, I will lodge: thy people shall be my people, and thy God my God.
If such conversion was good enough for the woman who would become King David’s great-grandmother, it was good enough for anyone.
(See this and other answers to this question at Quora.com)