Sahih al-Bukhari Book 68, Hadith 77
Ibn `Umar bin Al-Khattab divorced his wife during her menses. Allah's Messenger (ﷺ) ordered him to take
her back till she became clean, and when she got another period while she was with him, she should
wait till she became clean again and only then, if he wanted to divorce her, he could do so before
having sexual relations with her. And that is the period Allah has fixed for divorcing women.
Whenever `Abdullah (bin `Umar) was asked about that, he would say to the questioner, "If you
divorced her thrice, she is no longer lawful for you unless she marries another man (and the other man
divorces her in his turn).' Ibn `Umar further said, 'Would that you (people) only give one or two
divorces, because the Prophet (ﷺ) has ordered me so."
The sister of Ma'qil bin Yasar was married to a man and then that man divorced her and remained away from her till her period of the 'Iddah expired. Then he demanded for her hand in marriage, but Ma'qil got angry out of pride and haughtiness and said, "He kept away from her when he could still retain her, and now he demands her hand again?" So Ma'qil disagreed to remarry her to him. Then Allah revealed: 'When you have divorced women and they have fulfilled the term of their prescribed period, do not prevent them from marrying their (former) husbands.' (2.232) So the Prophet (ﷺ) sent for Ma'qil and recited to him (Allah's order) and consequently Ma'qil gave up his pride and haughtiness and yielded to Allah's order.
Ibn `Umar divorced his wife while she was having her menses. `Umar asked the Prophet (ﷺ) who said, "Order him (your son) to take her back, and then divorced her before her period of the 'Iddah has elapsed." I asked Ibn `Umar, "Will that divorce (during the menses) be counted?" He replied, "If somebody behaves foolishly (will his foolishness be an excuse for his misbehavior)?"