What you have mentioned in the question covers a number of issues:
1 – What you have mentioned about your friend divorcing his wife during her pregnancy is valid according to the consensus of the scholars, because of the hadeeth of Ibn ‘Umar in al-Saheehayn, according to which the Prophet (peace and blessings of Allaah be upon him) said: “Tell him to take her back, then to divorce her when she is pure (not menstruating) or pregnant.” That indicates that whoever divorces (his wife when she is) pregnant, the divorce is valid. (Fataawa al-Talaaq by Ibn Baaz, 1/45).
2 – With regard to the reason that led him to divorce her, which is that person telling him that she had been meeting with her former boyfriend after marriage, we advise those who want to pass things on to make sure that any news is true before they pass it on, and that their intentions are good. Her husband too should have checked whether what he was told was true or not, and not divorce her on these grounds without verifying anything. Allaah says (interpretation of the meaning):
“O you who believe! If a Faasiq (liar — evil person) comes to you with any news, verify it, lest you should harm people in ignorance, and afterwards you become regretful for what you have done”
Hastening to divorce one’s wife without verifying anything and without giving oneself time to think it over is a rejection of the blessing of marriage for no valid reason and destroying the family which is a blessing that Allaah has bestowed upon the children of Adam, as Allaah says (interpretation of the meaning):
“And among His Signs is this, that He created for you wives from among yourselves, that you may find repose in them, and He has put between you affection and mercy. Verily, in that are indeed signs for a people who reflect” [al-Room 30:21]
If he finds out that something displeasing is true, then he may try to correct it through the means which he is permitted to use by virtue of his being in charge of his wife (qiwaamah), or he may separate from her, whilst also concealing her sin.
3 – If the wife had previous relationships, before marriage, then she got married and repented to Allaah, and broke off all forbidden relationships, then she should not be rebuked for what is in the past, because the one who has repented from a sin is like one who has never sinned. Allaah says (interpretation of the meaning):
“And He it is Who accepts repentance from His slaves, and forgives sins” [al-Shoora 42:25]
It is not permissible to expose her, to tell everyone about her or to call her to account for the past; rather he should cover up her past and her secrets; whoever conceals the faults of a Muslim, Allaah will cover his faults in this world and in the Hereafter.
Such cases explain to us the wisdom of the sharee’ah in forbidding everything that may lead to an improper relationship between a man and a woman, such as looking at a non-mahram woman, shaking hands with her, being alone with her, and so on, whether that is before marriage or afterwards.
4 – With regard to the husband’s parents applying pressure on him to divorce her without any proof of the things of which she had been accused, obedience to parents should only be with regard to that which is good and proper, things that Allaah and His Messenger (peace and blessings of Allaah be upon him) have permitted. The Prophet (peace and blessings of Allaah be upon him) said: “Obedience is only with regard to that which is good and proper.” (Narrated by al-Bukhaari, 7245; Muslim, 1840). His parents’ orders to hasten to divorce her with no proven sin on the wife’s part is not something which is good and proper.
5 – With regard to the foetus in her womb, the basic principle in sharee’ah is that that the child belongs to the (marriage-) bed and belongs to the husband, unless he disowns him, because of the hadeeth of the Prophet: ‘The child belongs to the (marriage-)bed and the adulterer is to be stoned.” (al-Bukhaari, 2053; Muslim, 1457).
i.e., the child is to be attributed to the husband and no attention is to be paid to doubts and the like, especially in a case like this where the doubts are far-fetched. Islam encourages us to attribute children to their fathers, so this husband should not open the door to waswaas (whispers of the Shaytaan) with regard to his son who will be born to the wife he has divorced, because he has no evidence to the contrary.
If this husband wants to go back to his wife after this divorce (talaaq), if she is still pregnant and he issued the talaaq once or twice, then she is still his wife according to sharee’ah, because her ‘iddah has not yet ended. Allaah says:
“And for those who are pregnant (whether they are divorced or their husbands are dead), their ‘Iddah (prescribed period) is until they lay down their burden” [al-Talaaq 65:4]
So he may take her back and ask two men to bear witness that he is taking her back; in this way she will become his wife again.
But if she has already given birth and this was the first or second talaaq, then he may go back to her with a new contract, so long as it meets all the necessary conditions. And he should beware of such news and take care to protect his wife and keep her away from places which may give rise to suspicion. And Allaah knows best.