With regard to the prayers that you offered when you were not aware of the ruling on this action, there is no sin on you for that, and you do not have to make up the prayers that you offered when you were junub. Islam excuses the one who is ignorant whether he omitted obligatory actions or committed forbidden actions, so long as he did not fail to ask and try to find out. But if he failed to ask and try to find out, then he is sinning because of that shortcoming.
The scholars of the Standing Committee said:
It is not valid to pray without purifying oneself, for one who is in a state of minor or major impurity, according to scholarly consensus, because Allaah says (interpretation of the meaning):
“O you who believe! When you intend to offer As-Salaah (the prayer), wash your faces and your hands (forearms) up to the elbows, rub (by passing wet hands over) your heads, and (wash) your feet up to the ankles”
And the Prophet (peace and blessings of Allaah be upon him) said: “No prayer is accepted without purification.” Narrated by Muslim, 224.
Fataawa al-Lajnah al-Daa’imah, 6/259.
If you knew the Islamic ruling on praying when one is junub, and that it is not permissible for the junub person to pray until he has done ghusl, then you have sinned by doing that. You have to repent and seek forgiveness, regret what you have done and resolve not to go back to it. You also have to make up the prayers that you offered in that state.
The Scholars of the Standing Committee were asked:
I am a woman who has been married for seventeen years. At the beginning of my marriage I was unaware of some if not all of the rulings on ghusl following janaabah, because I was unaware of the causes of janaabah. My husband was similarly unaware. This ignorance made us think that only the husband becomes junub. I got married approximately two months before Ramadaan. At the end of Ramadaan in the same year, I came to know the ruling. What do I have to do with regard to the prayers that I offered during that period? Please note that I took showers with the intention of making myself clean, not with the intention of purifying myself, and I did not always do that, i.e., I did not take a shower every time I had intercourse. Please also note that I always do wudoo’ for every prayer. All this is the result of ignorance on my part, of course, as I stated. And what about my fasting during the blessed month of Ramadaan?
You have to make up the prayers that you offered without having done ghusl from janaabah, because of your carelessness and not trying to learn about your religion. As well as making up the prayers, you also have to repent to Allaah for that. With regard to the fasts, they are valid so long as no intercourse took place during the day.
Fataawa al-Lajnah al-Daa’imah, 6/269.
Those who prayed behind you do not have to repeat their prayers, because their prayers are valid, and have nothing to do with the validity of the prayer of their imam who prayed whilst junub without their knowledge.
The scholars of the Standing Committee were asked:
A few days ago when I wanted to do wudoo’ for Maghrib prayer, I noticed some maniy (semen) on my lower garment, so I did ghusl and prayed Maghrib, but I do not know when that wet dream occurred – was it before Fajr prayer or during the mid-day nap? The point here that I want to find out is: I think that I prayed three obligatory prayers – Fajr, Zuhr and ‘Asr – in a state of janaabah without realizing. In fact I offered these three prayers as an imam, leading a group of other worshippers who numbered some three hundred. What should I do? Should I make up these three prayers? And what is the ruling on the prayer of those who prayed behind me? Is there any sin in what I did? Please advise us, may Allaah reward you with good.
You have to repeat your Zuhr and ‘Asr prayers after doing ghusl from janaabah, and you have to do this soon. With regard to those who offered these prayers behind you, they do not have to repeat them. ‘Umar (may Allaah be pleased with him) led the people in praying Fajr when he was junub but had forgot, so he repeated Fajr but he did not tell those who had prayed behind him to repeat it. They were excused because they did not know that he was in an impure state. But you do not have to repeat Fajr, because the maniy may have appeared during your sleep at midday, and the basic principle is that a duty has been discharged and does not need to be repeated unless there is evidence to that effect.
Fataawa al-Lajnah al-Daa’imah, 6/266.
And Allaah knows best.