It is narrated from Sayyiduna Ubayy bin Ka'b (may Allah be pleased with him) that when the verse in Surah al-Baqarah about the waiting periods of women was revealed, they said: Some categories of women's waiting periods still remain: young girls, old women whose menstruation has stopped, and those who are pregnant (pregnant women). So Allah Almighty revealed this verse which is in (the Surah about) women: "And those who have despaired of menstruation among your women, if you are in doubt, their waiting period is three months, and (also for) those who have not menstruated. And for those who are pregnant, their term is until they deliver their burden" [Surah al-Talaq: 4]. Imam al-Shafi'i (may Allah have mercy on him) said that what is meant by the saying of Allah Almighty "if you are in doubt" is: "if you do not know what women who do not have menstrual cycles (qurū') should count, that is, how long a waiting period they should observe."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العدد / 15416