When I was young, I did the secret habit (masturbation) from the age of 12 and I did not know what it meant or even what it was. At the age of 14 I found out that it was that bad secret habit, but I did not know the ruling on it; I only knew that it was serious and that it causes diseases. At that age I did not pray, but I used to fast without praying.
At the age of 15, I began to pray and fast and I stopped listening to music, but I still did the secret habit and did not know the ruling on it; if I did it I did not do ghusl and I used to pray and fast after that. I did it twice during the day in Ramadan, I am not sure.
At the age of 18, I read in a book that it is haraam and that ghusl is required after it, but I could not repent from it and I carried on doing it even after getting married. But now I have repented sincerely to Allah and I am 27 years old.
My question is: what is the ruling on what I did and what should I do?
What is the ruling on my fasting and prayers when I used to do it and did not do ghusl, then I would pray? What is the ruling on my fast and what is the expiation for what I did? What is the ruling on the two days on which I did this habit in the day in Ramadan and what is the expiation?.
Masturbation, or what is called the secret habit, is haraam because of the evidence which has been explained in the answer to question number 329. If climax is reached as a result, it is obligatory to do ghusl (full ablution).
There is no particular expiation for masturbation, but it is obligatory to repent from it, by giving it up, regretting having done it and resolving not to go back to it.
If doing the secret habit is accompanied by climax, then this invalidates the fast and prayer is not valid unless you do ghusl.
If it was not accompanied by climax, then your prayer and fasting are valid.
If a person masturbates and is ignorant of the ruling that it is obligatory to do ghusl afterwards and that it invalidates the fast, does he have to make up the prayer and the fast? There is a difference of opinion among the fuqaha’ concerning that, but the majority are of the view that it is obligatory to make them up. Some scholars are of the view that it is not obligatory. See the answer to question number 50017.
In order to be on the safe side, you should make up the fast of those two days, if climax was reached.
With regard to prayer, you should do a lot of naafil prayers and righteous deeds, but we do not think that you are obliged to make them up.
You should know that there are signs of reaching puberty and that a girl may reach puberty before the age of 15, if she starts to menstruate or if any of the other signs of puberty appear. For more information on that, please see the answer to question number 20475 and 21246.
What happened to you emphasises the importance of seeking Islamic knowledge, which is something that is easy to do nowadays, praise be to Allah.
We ask Allah to guide us and you and make us steadfast.
And Allah knows best.