Your question includes a number of serious issues, not just one problem. The details are as follows:
1 – The neglect of prayer on the part of your friend and your relative, who claim to be Muslims. This action is kufr. See Question no. 5208 and 2182. Indeed, you say that they do not practise Islam, and this is disaster upon disaster, kufr upon kufr. We seek refuge with Allaah from that.
2 – Falling into zina (fornication, adultery), which is forbidden in Islam, as is well known. It is forbidden even in the other divinely-revealed religions.
3 – Marrying an adulteress when she is pregnant as a result of zina.
4 – The adulterer seeking to marry an adulteress after she has gotten married to someone else.
Which disaster should we begin with? Which question should we answer? Laa hawla wa laa quwwata illa Billaah (there is no power and no strength except with Allaah).
Let us start with the most serious:
1 – Kufr as a result of not praying and neglecting all the rituals of Islam.
There is no doubt that kufr (disbelief) dooms one to enter Hell, Allaah says describing the mushrikeen and how they will answer concerning the reason why they entered Hell:
“They will say: ‘We were not of those who used to offer the Salaah (prayers),
Nor we used to feed Al‑Miskeen (the poor);
And we used to talk falsehood (all that which Allaah hated) with vain talkers.
And we used to belie the Day of Recompense,
Until there came to us (the death) that is certain’”
[al-Muddaththir 74:43-47 – interpretation of the meaning]
Ibn Katheer said, commenting on this passage:
“ ‘We were not of those who used to offer the Salaah (prayers)’ means ,we did not worship our Lord.
‘Nor we used to feed Al‑Miskeen (the poor)’ means, we did not show any kindness to His creation of our own kind (our fellow human beings).
‘And we used to talk falsehood (all that which Allaah hated) with vain talkers’ means, we used to speak of that of which we had no knowledge. Qutaadah said: (it means), everyone who went astray, we followed him.
‘And we used to belie the Day of Recompense’. Ibn Jareer said: we used to deny the Day of Recompense, of reward and punishment; we did not believe in reward, punishment or reckoning.
‘Until there came to us (the death) that is certain’ means death, as in the aayah, ‘And worship your Lord until there comes unto you the certainty (i.e. death)’ [al-Hijr 15:99].”
But what you have to do is to advise them, establish proof against them and explain to them that what they are doing is destroying the most important pillar of Islam, so they must hasten to repent from neglecting the prayer and all the rituals of Islam. It is not permissible for you to turn a blind eye to one who neglects prayer under any circumstances. Start by advising and guiding him, then shun him and turn away from him, do not greet him, eat his food or sit with him, if that will do him some good. Make him aware of how great his sin is, so that perhaps he will turn back to his Lord and repent.
2 – Falling into zina (adultery) is a major sin. Allaah says (interpretation of the meaning):
“And come not near to unlawful sex. Verily, it is a Faahishah (i.e. anything that transgresses its limits: a great sin, and an evil way that leads one to hell unless Allaah Forgives him)”
The Prophet (peace and blessings of Allaah be upon him) said, “An adulterer, at the time he is committing illegal sexual intercourse is not a believer; and a drinker, at the time he imbibes an alcoholic drink is not a believer; and a thief, at the time of stealing, is not a believer. And a robber who robs (takes illegally something by force) while the people are looking at him, is not a believer at the time he is robbing (taking).” (Narrated by al-Bukhaari, no. 2475).
It is a major sin, and the one who commits this sin is issued with a warning of a painful torment. It says in the great hadeeth about the Mi’raaj (Prophet’s ascent to the heavens): “… We went on, and we came to something like a Tannoor (a kind of baking oven, a pit usually clay-lined for baking bread).” I [the narrator] think he said, “In that oven there was much noise and voices.” He said, “We looked into it and found naked men and women, and a flame of fire was reaching up to them from underneath, and when it reached them, they cried loudly. I asked them [the two angels], ‘Who are these people?’…
They [the two angels] said, ‘We will tell you… those naked men and women whom you saw in a structure resembling an oven, they are the adulterers and the adulteresses.”
(Narrated by al-Bukhaari in Baab Ithm al-Zunaah, no. 7047).
Please see also Question no. 11195.
3 – With regard to the third question, which concerns marrying an adulteress when she is pregnant, it should be noted that “it is not permissible to marry an adulteress until she repents, and if a man wants to marry her, he must wait to make sure that she is not pregnant, which is shown by her having a menstrual period, before he can marry her. If it becomes apparent that she is pregnant, then it is not permissible for him to marry her until she has given birth…” (Fatwa of Shaykh Muhammad ibn Ibraaheem – may Allaah have mercy on him. See al-Fataawa al-Jaami’ah li’l-Mar’ah al-Muslimah, 2/584)
Based on that, marriage to this woman when she is pregnant from an adulterer is an invalid marriage, and the person who married her has to leave her at once, otherwise he is an adulterer and the hadd punishment for adultery must be carried out on him.
But if he leaves her and she gives birth, and her womb becomes empty, and she repents sincerely, then it will be permissible for him to marry her, after he also repents.
4 – As for the first man – the adulterer – he must also repent to Allaah, and it is not permissible for him to marry her at all, for two reasons:
(i)because they are bother adulterers, and marriage to adulterers is forbidden to believers. See Question no. 11195.
(ii)Because of her relationship with another man.
So he has to forget about her completely, and repent to Allaah from his serious sin. Laa hawla wa laa quwwata illa Billaah al-‘Aliy al-‘Azeem (there is no power and no strength except with Allaah the Exalted, the Almighty).
O Allaah, guide the misguided Muslims, and help us to turn back to You, O Most Merciful of those who show mercy. Praise be to Allaah, the Lord of the Worlds.