Naomi stood alone and abandoned at the beginning of Megillat Ruth. Her husband and sons were dead, and she was stranded in the land of Moav.
Yet by the end of the megillah, Naomi had regained both home and offspring. Ruth married Boaz, and their son was regarded like one of Naomi's own children (4:17). At the same time, Naomi returned to her very own ancestral plot of land, which was purchased by Boaz at the same time he married Ruth. (4:9-10).
What happened in between the beginning of the megillah, when Naomi was deprived of everything, and the end when she had received everything back?
The difference is the acts of kindness and love performed by Naomi, Ruth, and Boaz. Ruth insisted in accompanying Naomi despite Naomi's foreign culture and old age; Naomi arranged an advantageous marriage for Ruth; while Boaz protected Ruth in his field and agreed to marry her and to redeem the family's land.
These acts of kindness are especially striking when set against the historical circumstances of the period – as the megillah carefully indicates to us. The story is introduced as being "during the rule of the judges". Anyone who has read the book of Judges knows that this was not a period of love and kindness among the Jewish people. The defining event from this period was the story of pilegesh begivah (Shoftim 19-21). There, a traveler visited Givah, in the tribe of Binyamin. Some of the city's less responsible men demanded to "get to know" the traveler, similar to what had once happened in Sodom. His host refused, but the traveler agreed to let the men take his concubine (he was probably willing to do this because, as we previously learn, the concubine had recently cheated on him). The men raped and abused the concubine, and by the next morning she was dead. The traveler cut the concubine's corpse into 12 pieces, and delivered one to each tribe in Israel. The tribes, enraged, came and killed nearly the whole tribe of Binyamin in revenge.
These are the circumstances in which Naomi, Ruth, and Boaz showed their great kindness to each other. The time period was similar and Boaz and Naomi, like the traveler, came from Beit Lechem. Yet the actions in the megillah are quite the reverse of those in Shoftim. The concubine's unfaithfulness to the traveler (and then, vice versa) contrasts with Ruth's faithfulness to Naomi. Boaz's hospitality to Ruth contrasts with the inhospitality the traveler encountered in Givah. The arranged kidnapping of Israelite women in order to provide wives for the remaining Binyaminites contrasts with Boaz's refusal to sleep with Ruth until they were properly married.
While the love and kindness in the megillah were rewarded by offspring and inheritance of the land, the hatred and insensitivity of Shoftim were punished by the loss of offspring and the land. Almost the entire tribe of Binyamin, and thousands of soldiers from the other side, were killed in the Givah war. And the entire Shoftim period was characterized by a loss of land, as the disunified tribes were progressively overcome by the Philistines and other neighboring peoples.
Sefer Shoftim ends with the following verdict: "In those days there was no king in Israel, and each person would do whatever was right in their eyes." The usual interpretation of this is that a king could suppress and prevent evil behavior. But it can be equally understood as referring to internal dissension: without a king people would not unite against external enemies, and would even take up arms against each other.
It is no coincidence that the first successful king – David – was a descendant of Ruth and Boaz. He came to power in a period of civil war between Binyamin and Yehudah. But he managed to reconcile the two sides by showing friendship to Shaul's family and the rest of Binyamin, and by choosing a capitol (Jerusalem) which was on the border between the two tribes. During his reign the Jewish kingdom expanded to its widest extent ever, and grew to be numbered "like the stars of the sky" (Divrei Hayamim Alef 27:23). Just as Ruth's family succeeded in reversing their personal punishments by the practice of love and kindness, their descendant David succeeded in doing the same for the entire nation.