From Aboo Hurayrah radi Allaahu ‘anhu that the Prophet sall Allaahu ‘alahi wa sallam said:
Whoever forgets whilst fasting and so he eats or drinks, then let him complete his fast; for it was only Allaah who fed him and gave him drink.
The Shaykh Muhammad ibn Saalih al ‘Uthaymeen rahimahullaah commented:
Aboo Hurayrah radi Allaahu ‘anhu informed from the Prophet sall Allaahu ‘alaihi wa sallam that he commanded the fasting person who forgets, and so eats and drinks, that he should complete his fast and continue with it, because it does not become deficient through that, in that it occurred without his choosing that.
So it is as if Allaah, the Most High, was the One who fed him and gave him drink.
And this ruling with regards to the fasting person is one example of a tremendous general principle contained in His statement, He the Most High:
O our Lord, do not take us to account if we forget or fall into error…
Soorah al Baqarah (2) aayah 286
So Allaah, the Most High, said:
Indeed I have granted it.
(taken from Sh Uthaymeen’s explanation of ‘Umdat-ul-Ahkaam
translated by Nasser ibn Najam)