Praise be to Allah.
The child who is born out of wedlock has not sinned and there is no burden of sin on him for the sin of those who committed zina (adultery). The issue of whether he will be righteous or will go astray depends on many factors, the most important of which is a good upbringing. If he receives a good upbringing and does not encounter any rejection or condemnation from society, he is more likely to become righteous, just like other children.
Rather many cases of going astray among children who were born out of wedlock occur because in most cases they do not receive care or attention, and they encounter rejection and alienation from people, so they become easy targets for evildoers and deviants.
Raising children is something that requires patience and effort. How many families suffer problems in raising children, especially when the children enter the adolescent phase and especially if the father is neglectful or remote or has gone astray.
Our advice to you is to strive to be patient and persevere, and to surround your children with compassion and love; provide them with a good environment and good company; try to fill their spare time with beneficial things; encourage them to become attached to the mosque or Islamic centre; encourage them to read and acquire knowledge; strengthen their faith by always remembering Allah and reading Qur’aan; make the most of occasions for worship such as Ramadan; and constantly make du‘aa’ and turn to Allah, may He be exalted, and ask Him to guide them and set their affairs straight.
It was narrated that Abu Hurayrah said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “There are three prayers that will undoubtedly be answered: the prayer of one who has been wronged; the prayer of the traveller; and the prayer of a father for his child.”
Narrated by al-Tirmidhi, 1905; Abu Dawood, 1563; and Ibn Maajah, 3862. Classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
Al-Azeemabaadi (may Allah have mercy on him) said: “The prayer of a father for his child” refers to a father’s prayer for or against his son; no mention is made of the mother because her rights are greater, so her du‘aa’ is more likely to be responded to.
End quote from ‘Awn al-Ma‘bood, 4/276
You should strive to guide your husband and bring him back to righteousness, so that he will take part in raising and guiding the children. You should pay particular attention to the greatest of obligatory duties, namely prayer, because prayer is the foundation of faith and the one who does not pray has no share in Islam.
We ask Allah, may He be exalted, to grant you the joy of seeing them all become righteous and upstanding.
And Allah knows best.