It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with him) that when a woman gives birth after nine months, twenty-one months of breastfeeding suffice her; when she gives birth after seven months, twenty-three months of breastfeeding (that is, nursing the child) suffice her; and when she gives birth after six months, twenty-four months of breastfeeding suffice her, just as Allah Almighty has said: 'And his bearing and his weaning is thirty months' [Surah al-Ahqaf: 15].
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العدد / 15548
It is narrated from Abu Harb bin Abi al-Aswad al-Dili that a woman who had given birth after six months was brought to Umar (may Allah be pleased with him), and Umar (may Allah be pleased with him) intended to stone her. This reached Ali (may Allah be pleased with him), and he said: There is no stoning upon her. This reached Umar (may Allah be pleased with him), so he sent a messenger to him to ask him, and he said: 'And mothers shall breastfeed their children for two complete years, for whoever wishes to complete the nursing' [Surah al-Baqarah: 233], and He said: 'And his bearing and his weaning is thirty months' [Surah al-Ahqaf: 15]. So six months is the period of his bearing and two years is the period of his weaning; there is no prescribed punishment (hadd) upon her, or he said: there is no stoning upon her. So Umar (may Allah be pleased with him) let her go, and then she gave birth.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العدد / 15549
Imam Malik (may Allah have mercy on him) said that it reached him that a woman who had given birth after six months was brought to Sayyiduna Uthman bin Affan (may Allah be pleased with him). Sayyiduna Uthman bin Affan (may Allah be pleased with him) ordered that she be stoned, whereupon Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) said: Stoning is not due upon her. Allah Almighty has said: "And the bearing of him and the weaning of him is thirty months" [Surah al-Ahqaf: 15]; and He said: "And his weaning is in two years" [Surah Luqman: 14]; and He said: "Mothers shall breastfeed their children for two complete years" [Surah al-Baqarah: 233]. So the period of breastfeeding is twenty-four months and the period of pregnancy is six months. Sayyiduna Uthman (may Allah be pleased with him) gave an order concerning her, and she was to be brought back, but it was found that she had already been stoned. And Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العدد / 15551