Al-Bukhaari (6669) and Muslim (1155) narrated that Abu Hurayrah (may Allaah be pleased with him) said: The Prophet (peace and blessings of Allaah be upon him) said: “Whoever forgets he is fasting and eats or drinks, let him complete his fast for it is Allaah Who has fed him and given him to drink.”
It was also narrated that he does not have to offer expiation or make up that fast.
Ibn Khuzaymah (1999) narrated from Abu Hurayrah that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever breaks his fast in Ramadaan by mistake does not have to make up that day or offer expiation.” Classed as hasan by al-Albaani in Saheeh Ibn Khuzaymah.
Al-Daaraqutni narrated from Abu Sa’eed al-Khudri that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever eats in the month of Ramadaan by mistake does not have to make up that day.”
Although its isnaad is weak, it may still be considered sound because there are corroborating reports. The least that could be said about it is that it is hasan, so it may be quoted as evidence. Reports that are less strong than this have been quoted as evidence with regard to many issues. It may also be supported by the fact that a number of the Sahaabah issued fatwas that are in agreement with this hadeeth without any one of the Sahaabah having a different view, as was stated by Ibn al-Mundhir, Ibn Hazm and others, and ‘Ali ibn Abi Taalib, Zayd ibn Thaabit, Abu Hurayrah, and Ibn ‘Umar. And it is in accordance with the words of Allaah (interpretation of the meaning):
“but He will call you to account for that which your hearts have earned”
Forgetfulness is not something which is earned by the heart.
This hadeeth tells of the kindness of Allaah to His slaves and how He makes things easier for them and alleviates hardship.
The majority of scholars quote these ahaadeeth as evidence that whoever forgets that he is fasting and breaks the fast, his fast is still valid, and he should complete his fast, and he does not have to make it up or offer any expiation. The general meaning of the hadeeth covers both obligatory and naafil fasts; there is no difference between the two.
Al-Shaafa’i said in al-Umm (2/284):
If a fasting person eats or drinks in Ramadaan or in a fast observed in fulfillment of a vow or as an expiation, or a fast that is obligatory for some reason, or a voluntary fast, out of forgetfulness, then his fast is complete and he does not have to make it up.
This is evidence to support the view of the majority: if the fasting person eats or drinks or has intercourse because of forgetfulness, then he does not break his fast. Among those who were of this view are al-Shaafa’i, Abu Haneefah, Dawood and others.
An interesting story was narrated by ‘Abd al-Razzaaq from ‘Amr ibn Dinar: that a person came to Abu Hurayrah and said: “I started fasting in the morning then I forgot and ate.” He said, “It does not matter.” He said: “Then I entered upon someone and by mistake I ate and drank.” He said, “It does not matter, Allaah has fed you and given you to drink.” Then he said: “I entered upon another person and forgot, and ate.” Abu Hurayrah said: “You are a person who is not used to fasting.”.