Praise be to Allah.
Having intercourse with a menstruating woman in her vagina is haraam, because Allaah says (interpretation of the meaning):
“They ask you concerning menstruation. Say: that is an Adha (a harmful thing for a husband to have a sexual intercourse with his wife while she is having her menses), therefore, keep away from women during menses” [al-Baqarah 2:222]
Whoever does that has to seek the forgiveness of Allaah and repent to Him, and he has to give a dinar or half a dinar in charity as expiation for what he has done. Ahmad and the authors of al-Sunan narrated with a jayyid isnaad from Ibn ‘Abbaas (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever has intercourse with his wife when she is menstruating should give a dinar or half a dinar in charity.” Whichever you give is sufficient.
It is not permissible to have intercourse with one's wife after she has become pure, i.e., after the bleeding has stopped, and before she has done ghusl, because Allaah says (interpretation of the meaning):
“and go not unto them till they are purified (from menses and have taken a bath)”
Allaah has not given permission for a man to have intercourse with a menstruating woman until her bleeding stops and she purifies herself, i.e., does ghusl. Whoever has intercourse with his wife before she has done ghusl has committed a sin and has to offer expiation (kafaarah).
See Fataawa al-‘Ulama’ fi ‘Ushrat al-Nisa’, p. 51
Fatwa al-Lajnah al-Daa’imah
With regard to the way to rid oneself of sins that a man and woman have committed, please see Question No. 14289, 329.
You have to repent to Allaah for going against the prohibition mentioned in this aayah and for not paying heed to the words (interpretation of the meaning):
“And when they have purified themselves, then go in unto them as Allaah has ordained for you” [al-Baqarah 2:222]
That is done by regretting what has happened and resolving not to do it again, and by doing a lot of good deeds, for good deeds wipe out bad deeds. And Allaah is Oft-Forgiving, Most Merciful.