I'm sure Diego will have a deep and scholaly answer that will tell us the answer. Until then, as a just beginning to understand Bible reader, I think it is because of the beautiful story it tells.
I have been taught that Ruth is symbolic of us, sinners that are weak and condemned while Boaz is kinsman redeemer - Jesus. Ruth will inherite the land of Boaz as we will inherite eternal life.
As far as Rehab goes - Is Rehab the harlot the same Rehab as mentioned in Matthew? Also, Matthew gives us the genealogy of Joseph, the step-father to Christ. Luke gives the genealogy of Mary.
Who else would Rachab be??? and why mention her??? And the genealogies from David to Adam are the same.