Matthew lists Rahab the prostitute of Jericho as one of Jesus' ancestors. I've sometimes wondered why. Yes, she risked her life to save the spies sent by Joshua to Jericho. But would that be enough for her to be included among the other women in Matthew's list along with such famous women as Mary, Ruth, Bathsheba and Tamar? All of these except Mary are mentioned in the OT as having clear ancestral ties to the Davidic lineage. So why did Matthew include her, while Luke did not?
I discovered some rabbinical legends yesterday that may shed light on Matthew's decision: namely, Rahab became the wife of none other than Joshua and the mother of famous prophets including Jeremiah, Huldah and Ezekiel. The story can't be confirmed biblically and the rabbis disagree about Joshua's marrying her, but I think it is likely that her fame would be known to Matthew. Luke, on the other hand might not have known of it or might decide not to include it since his audience would not be aware of Rahab's story, let alone that of the other women mentioned by Matthew.
Eight prophets, who were also priests, descended from Rahab the prostitute, and they are: Neriah; his son Baruch; Seraiah; Mahseiah; Jeremiah; his father, Hilkiah; Jeremiah’s cousin Hanamel; and Hanamel’s father, Shallum. Rabbi Yehuda said: So too, Huldah the prophetess was a descendant of Rahab the prostitute… Rav Naḥman responded... Rahab converted and married Joshua, and therefore Huldah descended from both Joshua and Rahab. (Megillah 14b)
Did Matthew know of the stories that underlie these reports in the Talmud? I also wonder if the story of Rahab's marriage to Joshua and her ancestry of important prophets was known to any of the Church Fathers, or if there are references to her history (other than her role in protecting the spies in Jericho) in other early Christian writings.