Praise be to Allah.
This question includes two issues:
1 – Intercourse on the part of one who is fasting
2 – Rulings on one who has intercourse but does not do ghusl
If a person who is fasting has intercourse with his wife during the day in Ramadaan, one of the following two scenarios must apply:
The first scenario: he thinks that having intercourse without ejaculating is not haraam during the day in Ramadaan, so he has intercourse and he is ignorant or unaware of the ruling.
The second scenario: he knows that having intercourse (during the day in Ramadaan) is haraam but he does not know what the punishment is.
With regard to the first scenario, Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said:
The most correct view is the view of those who say that whoever does one of the things that break the fast or one of the things that are forbidden during ihraam or one of the things that invalidate the prayer and is unaware of it, then there is no sin on him, because Allaah says (interpretation of the meaning):
“Our Lord! Punish us not if we forget or fall into error”
and Allaah has said: “I have done that.”
So if this man who had intercourse with his wife during the day in Ramadaan was unaware of the ruling, and he thought that the kind of intercourse that is haraam is the kind in which ejaculation occurs, then he does not have to do anything.
But in the second scenario, if he knew that intercourse (during the day in Ramadaan) is haraam, but he did not know that there is expiation (kafaarah) for that, then he has to offer the expiation, because there is a difference between ignorance of the ruling and ignorance of the punishment. Ignorance of the punishment is no excuse, but ignorance of the ruling is an excuse.
Hence the scholars said: If a person drinks an intoxicant thinking that it will not cause intoxication, or thinking that it is not haraam, then there is no sin on him. But if he knows that it will cause intoxication and that it is haraam, but he does not know that he is to be punished for that, then he should be punished and he is not excused from that. Based on this, we say to the questioner that so long as you did not know that intercourse without ejaculation was haraam, there is no sin on you or on your wife, if she was also ignorant of the ruling as you were.
The effect of this action on fasting and prayer.
With regard to fasting, janaabah (being in a state of impurity following sexual activity) does not have any effect on it, because the fasting of a person who is in a state of janaabah is valid. But not doing ghusl in order to pray poses a problem, because prayer is not valid without doing ghusl because the person remains in a state of janaabah. Most of the scholars are of the view that this person must make up all the prayers for which he did not do ghusl, but is it known that this man will have had intercourse and ejaculated, and then done ghusl.
But he may not know how often he did that. So we say to him that he should try to work it out and do his best to make up the prayers, to be on the safe side. But if you did not know anything about this and it did not cross your mind that simply having intercourse without ejaculating would mean that ghusl was essential, then we hope that you do not have to do anything, i.e., that you do not have to make up the prayers. But you do have to repent and seek forgiveness for your negligence in not asking about the matter.
Shaykh Ibn ‘Uthaymeen, al-Liqa’ al-Shahri
See also the answer to question no. 9446