There are a number of weak hadeeths that are narrated concerning this matter, that cannot be proven to be from the Prophet (blessings and peace of Allah be upon him).
Abu Ya‘la (455) narrated that ‘Ali ibn Abi Taalib said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Feed your pregnant womenfolk fresh dates; if there are no fresh dates, then dried dates, for there is no tree that is dearer to Allah than a tree beneath which Maryam bint ‘Imraan stayed.”
Ibn Katheer (may Allah have mercy on him) said in his Tafseer (5/199): This is a very odd (munkar) hadeeth. End quote.
Al-Khateeb narrated in Tareekh Baghdaad (9/336) that Salamah ibn Qays said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Feed your womenfolk dates during their nifaas, for any woman who eats dates during her nifaas, her child will be forbearing, because that was the food of Maryam when she gave birth to ‘Eesa was born. If Allah knew of any food that was better for her than dates, He would have given it to her.”
Shaykh al-Albaani (may Allah have mercy on him) said in as-Silsilah ad-Da‘eefah (234): It is fabricated.
Abu Nu‘aym narrated in at-Tibb (459) that Abu Hurayrah said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “In my view, there is no remedy for the woman in nifaas like fresh dates, and no remedy for one who is sick like honey.”
The isnaad of this hadeeth includes ‘Ali ibn ‘Urwah. Ibn Hibbaan said: He used to fabricate hadeeth. Saalih Jazarah and others stated that he was a liar. See: Mizaan al-I‘tidaal (3/145). It was also narrated by Shaykh al-Albaani in ad-Da‘eefah (264) and he said: It is fabricated.
Ibn Sam‘oon narrated in al-Amaali (p. 239) from Shahr ibn Hawshab that Abu Umaamah al-Baahili (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Feed your women in nifaas fresh dates.” They said: O Messenger of Allah, fresh dates are not available all the time. He said: “Then dried dates.” They said: O Messenger of Allah, all dried dates are good, but which are the best of dried dates? He said: “The best of your dried dates are al-barni; they bring healing and expel sickness, there is no sickness in them, they are most satisfying for the one who is hungry and they warm up the one who is cold.”
Shahr ibn Hawshab is da‘eef in hadeeth. This hadeeth of his was narrated by al-Albaani in ad-Da‘eefah (260), and he classed it as da‘eef.
However it is proven from more than one of the early generations that it is recommended for women in nifaas to eat fresh dates. Ibn Abi Shaybah (5/60) narrated with a saheeh isnaad that Ibraaheem an-Nakha‘i said: They used to recommend fresh dates for women in nifaas.
Al-Fadl ibn Dakeen narrated in his book as-Salaah (p. 129) that ar-Rabee‘ ibn Khuthaym said: In my view there is no remedy for women in nifaas like fresh dates.
See: Fath al-Baari by Ibn Hajar (may Allah have mercy on him), 9/477
What appears to be the case that the view of those among the early generations who said that could only be based on experience and custom. Medical research has determined that fresh dates contain a substance that contracts the uterus and strengthens uterine muscles, and helps with childbirth; it also reduces the amount of bleeding that occurs after childbirth.
Similarly, they also contain a high amount of simple sugars that are easily digested, which is a basic source of energy and is important and beneficial for the muscles, especially the uterine muscles which play a big role during childbirth.
There is nothing more beneficial for the pregnant woman and her foetus than seeking to eat halaal foods and keeping away from haraam and dubious foods, so the woman and her husband should try hard to do that.
And Allah knows best.