The story of Ruth is one of unexpected consequences. That is to say, Alimelech did not seek to die when he packed up and left Betlehem. He certainly didn't expect his sons to die. But the famine reached the land of Moab as well. A decade had passed, leaving three widows.
But Naomi knew the Law. Jubilee had come, so surely God would provide. But how, and by whom? As it turned out, the help came from a cousin.
Through some shrewd matchmaking, Naomi got her daughter in law to meet up with Boaz. A closer relative had refused to complicate his own life, so Ruth and her late husband's land past to Boaz, then to Jesse, David.
God had shown that good things come even through the Moabites. God has a way of working with broken vessels. Judah had started out really bad; so had Lot. But God brought their two lines together.
God doesn't always do what we expect, but we cam be sure that He knows what he's doing.