During the time of the Judges when there was a famine, an Israelite family from Bethlehem - Elimelech, his wife Naomi, and their sons Mahlon and Chilion - emigrate to the nearby country of Moab. Elimelech dies, and the sons marry two Moabite women: Mahlon marries Ruth and Chilion marries Orpah. Then Mahlon and Chilion also die. Naomi decides to return to Bethlehem. She tells her daughters-in-law to return to their own mothers, and remarry. Orpah reluctantly leaves; however, Ruth says, "Don't urge me to leave you or to turn back from you. Where you go I will go, and where you stay I will stay. Your people will be my people and your God my God. Where you die I will die, and there I will be buried. May the LORD deal with me, be it ever so severely, if anything but death separates you and me." (Ruth 1:16-17 NIV) The two women return to Bethlehem. It is the time of the barley harvest, and in order to support her mother-in-law and herself, Ruth goes to the fields to glean. The field she goes to belongs to a man named Boaz, who is kind to her because he has heard of her loyalty to her mother-in-law. Ruth tells her mother-in-law of Boaz's kindness, and she gleans in his field through the remainder of the harvest season. Boaz is a close relative of Naomi's husband's family. He is therefore obliged by the levirate law to marry Mahlon's widow, Ruth, in order to carry on his family line. Naomi sends Ruth to the threshing floor at night and tells her to "uncover the feet" of the sleeping Boaz. Ruth does so, Boaz awakes, and Ruth reminds him that he is "the one with the right to redeem." Boaz is willing to "redeem" Ruth, but there is a closer relative with a stronger right to do so. The next morning, Boaz discusses the issue with this man before the town elders. The other relative is unwilling to jeopardise the inheritance of his own estate by marrying Ruth, and so Boaz is free to do so. Boaz and Ruth get married and have a son named Obed (who by levirate customs is also considered a son or heir to Mahlon, and thus Naomi's grandson). In the genealogy which concludes the story, it is pointed out that Obed is the descendant of Perez the son of Judah, and the grandfather of David.
(Summary by Wikipedia)