All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
First of all, it should be mentioned that marriage is serious contract and there are some religious rulings which apply to it, so one should not be lenient about it or marry without learning its rulings otherwise many unpleasant consequences could result from it.
As regards the marriage of your friend with this woman, if it happened without a guardian, as it appears from the question, then it is invalid because the consent of the guardian is one of the conditions for the validity of the marriage according to the most preponderant opinion of the scholars . Therefore, such marriage should be invalidated and if there are any children they should be traced back to their father [since he married her believing that the marriage contract was correct]. However, it is permissible to renew the marriage contract with the consent of the guardian. For more benefit, please refer to Fatwa 83629.
The second matter that has to be considered is whether or not this marriage took place during the waiting period. If it took place during the waiting period, then according to the most preponderant opinion of the scholars the marriage is void. Therefore, it must be invalidated and they should be immediately separated. If your friend married her while they both know that it is forbidden to marry while in the waiting period, and yet he had sexual intercourse, then they are both fornicators. In this case, the children should not be traced back to him, and the woman does not deserve the dowry. However, if they both were unaware that it is forbidden to have sexual intercourse while in the waiting period, then the children, are traced back to him, and the woman deserves the dowry. In case he knew about this whereas she did not know, then he is obliged to pay the dowry, and the children should not be traced back to him. On other hand, if she knew about the ruling while he did not know about it, then she does not deserve the dowry and the children are traced back to the man.
Nonetheless, if they both want to remarry with a new marriage contract, then this is permissible according to the Hanafi and Shaafi'ee Schools of jurisprudence. This is also the view chosen by Ibn Taymiyyah . If this marriage takes place after the waiting period, then it is a correct marriage.
For more benefit, please refer to Fatwa 83672.
As regards the first pregnancy which was due to your friend impregnating the woman, then if she gave birth to him six months or more after the marriage contract and he had sexual intercourse with her during this period, then the child is traced back to the husband as he was born through a marriage, the legitimacy of which is controversial. It is confirmed that the Prophet said: "The boy is for (i.e. traced to) the owner of the bed (legitimate husband)." [Al-Bukhari and Muslim]
However, if she gave birth to the child after less than six months from the marriage contract, then he should be traced back to his mother as he is born out of an illegal sexual intercourse (because no legitimate pregnancy takes place in less than six month).
Finally, it should be noted that Zina (fornication and / or adultery) is a major grave sin and an obnoxious act which has a very bad effect on the individual and the society.
Therefore, your friend is obliged to repent before death comes to him while he is persisting on this sin.
Allaah Knows best.