All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The marriage of that man with that woman before the expiry of her ‘Iddah from her deceased husband is invalid by the agreement of the scholars; please refer to fatwa 303799. The ‘Iddah of a pregnant woman ends by giving birth to her child; Allah says (what means): {And for those who are pregnant, their term is until they give birth.} [Quran 65:4] And the child is attributed to his deceased father.
What that man had to do was to separate from her, especially given that he knew that she was pregnant from her deceased husband. Therefore, he must repent to Allah of what he did; the conditions of repentance are highlighted in fatwa 86527.
Some scholars held that a man who marries a woman in her ‘Iddah becomes forbidden to marry her forever, while the majority of the scholars held that he is permitted to marry her after her ‘Iddah expires.
If the situation is as you mentioned, that he married her after the end of her ‘Iddah, then the marriage is valid according to the view of the majority of the scholars, and the child that is born of this marriage is attributed to him, and they inherit from each other.
Perhaps the shaykh whom you mentioned has the view of those who said that she is forever forbidden to marry him because of their marriage during the ‘Iddah.
As for the saying that she is forbidden for him because she has given birth in his house to a child from her deceased husband, then we do not know of any scholar who said this.
Finally, we would like to bring your attention to the two following matters:
1- There is a difference of opinion between the scholars of Fiqh about the overlapping of the two ‘Iddahs in such a case. Some jurists are of the view that they do overlap, meaning that one of them is sufficient to fulfill the other. They explained that the purpose of the ‘Iddah is to make sure that the woman is not pregnant, and this is achieved by either of the two ‘Iddahs. However, some others are of the view that they do not overlap, so after she finishes her ‘Iddah from the first husband [i.e. the deceased husband], she observes the ‘Iddah from the second husband [who divorced her]. They explained that these are rights intended for two different human beings, so one of them is not sufficient to fulfill the other, just like two debts [owed to two different people]. The issue is a matter of Ijtihaad (personal reasoning by scholars).
2- A Muslim must ask about what he needs to know of the Shariah rulings before he acts. Al-Qurtubi said in his Tafseer (exegesis):
“A layman who does not derive the rulings from their principles (texts) in regard to any part of his religion that he does not know because of him not being qualified to do so is obliged to go to the most knowledgeable person of his time or in his country and ask him about his case; and then he should act upon his fatwa, as Allah says (what means): {So ask the people of the message if you do not know.} He must endeavor to find the most knowledgeable person of his time in such a way that most of the people agree on him.”
Allah knows best.