[Machine] Imam al-Shafi'i, may Allah have mercy on him, said in his book "Rulings of the Qur'an": If a man has intercourse with his wife while she is menstruating or after the period has ended and she has not yet performed ghusl (ritual bath), he should seek forgiveness from Allah, the Most High, and should not resume sexual relations until she becomes purified and becomes permissible for him to pray. It has been narrated that there is something in this matter that, if confirmed, we would take into consideration. However, it is not confirmed.
قَالَ الشَّافِعِيُّ رَحِمَهُ اللهُ تَعَالَى يَعْنِي فِي كِتَابِ أَحْكَامِ الْقُرْآنِ فِيمَنْ أَتَى امْرَأَتَهُ حَائِضًا أَوْ بَعْدَ تَوْلِيَةِ الدَّمِ وَلَمْ تَغْتَسِلْ يَسْتَغْفِرُ اللهَ تَعَالَى وَلَا يَعُودُ حَتَّى تَطْهُرَ وَتَحِلَّ لَهَا الصَّلَاةُ وَقَدْ رُوِيَ فِيهِ شَيْءٌ لَوْ كَانَ ثَابِتًا أَخَذْنَا بِهِ وَلَكِنَّهُ لَا يَثْبُتُ مِثْلُهُ