The Prophet's Marriage to his Fostered son's ex-wife
The custom among the pagan Arabs was that an adopted son was like a person’s real son. He carried his adopted father’s name and inherited from him. God’s Message in the Quran overturned that custom. Quran, we must understand, came to safeguard lineage. A man may 'adopt' a child and take care of him, but that child cannot assume the lineage of his 'adopted father' - as in the sense of long term fostering. He must retain his own family name, it was henceforth prohibited to do otherwise.
God says: “Nor has He made your adopted sons your sons. Such is only your (manner of) speech by your mouths. But God tells you the Truth, and He shows the right way that is correct. Call them by the names of their fathers: that is more just with God. But if ye know not their father’s names, (then they are) your brothers in faith, or your wards.” [Sûrah al-Ahzâb: 4-5]
By marrying the ex-wife of his fostered son, the Prophet (peace be upon him) demonstrated in the clearest possible way that in Islam an adopted son is not the same as a natural son and that the guardian of an adopted son is permitted to marry a woman who was once married to that adopted son.
As for the verse itself, God says: “And (remember) when you said to him on whom Allah has bestowed grace and you have done a favor: ‘Keep your wife to yourself, and have awe of God.’ But you did hide in yourself that which God will make manifest, you did dread the people whereas God had a better right that you should dread (awe) Him. So, when Zayd had completed his formalities (of divorce) with her, We gave her to you in marriage, so that there may be no difficulty to the believers in respect of the wives of their adopted sons when the latter have no desire to keep them. And God's command must be fulfilled.” [Sûrah al-Ahzâb: 37]
Naturally, the Prophet would have dreaded to go against his society’s conventional ethics and standard. This, however, was from God’s wisdom. If the Prophet (peace be upon him) had only said to the people that since adopted children are not true children, therefore they are permitted to marry the ex-spouses of their adopted sons and daughters, it would not have had the same effect. Cultural practices and taboos are quite strong. For instance, as Muslims we all know that race and ethnicity are not important. However, we can see the problems that almost invariably arise when a Muslim girl wants to marry a Muslim boy (or vice a versa) from a different ethnic background. Therefore, the Prophet (peace be upon him) was commanded to marry her by way of example.
In the very next verse, God continues: “There can be no difficulty upon the Prophet in what God has obliged him to do. That was God's way with respect to those who have gone before. And the command of God is a decree determined.” [Sûrah al-Ahzâb: 38]
As for the controversial story found in the apocryphal sources. It is generally acknowledged by Muslims scholars that the story is baseless and full of contradictions and are not up to acceptable standards regarding authenticity. In some of the narrations it was said that the Prophet Muhammad (peace be upon him) came to visit Zayd, but Zayd was not home before the Prophet was received by Zaynab [the wife of Zayd]. While other narrations state that Zayd was ill, therefore the Prophet went to see him. So, Zayd, Zaynab and the Prophet were all at the same room. How could Zayd be away and ill in bed at the same time? The narrators differ in narrating the state and the way in which the Prophet saw Zaynab; some said he was at the door, others say she came out, while others say he saw her when the wind blew the fabric barrier. Furthermore there are several faults in the chain of transmission. However, what is known from the Quran is that the marriage between Zayd and his wife was unstable, the sensualising thereof is unwarranted.
Moreover, the Quran admits no other source to be used in conjunction with the Quran's interpretation or as a separate source for law or judge. 45:6, 6:114.
Perhaps this story was influenced by the alleged Story of Daivd (peace be upon him) and Bathsheba found in the Bible, 2 Samuel 11. Some Muslims or possibly converts from the people of the previous Judea-Christian scripture probably read that story and told a similar story about Prophet Muhammad (peace be upon him) and Zaniab Bint Jash. Moreover, such stories were made up by certain influential individuals to appease the licentious ruling elite. Either way, the story is false and baseless. It would be disingenuous and intellectually dishonest to claim otherwise.
And Allah knows best.
 One of the wisdom behind this is that estranged couples may meet and court or get involved in intimate relationships between siblings, being unaware of their lineage for example http://www.dailymail.co.uk/news/article-1282575/Couple-discover-siblings-Child-courts-blamed-strangers-fall-love-son--half-brother-sister.html
 As has been acknowledged by scholars past and present: This story is baseless. It does not come to us with any chain of transmission worth mentioning. If we wish to believe this story, we might as well believe anything that people tell us.
This story is found in some books like al-Tabarî’s Tafsîr, but he relates it without any chain of transmission and starts by saying: “It was said that…”
For this reason, Ibn Kathîr does not mention it at all in his commentary of the Qur’ân. In his monumental work on history, al-Bidâyah wa al-Nihâyah, Ibn Kathîr discusses the marriage of Zaynab bint Jahsh and mentions that there were some strange stories circulated by the early scholars, but many of them were dubious and should be abandoned. Fatwa Department Research Committee - chaired by Sheikh `Abd al-Wahhâb al-Turayrî, Islamtoday.net