For the first few days in Ramadan, every year, there is tendency for some Muslims to forget that they are fasting and thus break their fasts inadvertently during the day. Naturally, the possibility of eating or drinking accidentally due to sheer forgetfulness in the early days of Ramadan is apt. This often occurs to Muslims who hardly fast outside the month of Ramadan.
If it happens to you, there should be nothing to worry about. As soon as you remember, just recondition yourself to the regulations of Ramadan and continue your fast. Do not tell anybody. Let it remain a secret between you and your Lord. It does not matter whether you remember while eating and drinking or thereafter.
In Islam, actions are judged according to intentions. And who else judges both actions and intentions other than Allah, the All-seer and All- knower.
Even in the five obligatory Salats observed daily by all genuine Muslims, provisions are made for rectification of errors made through forgetfulness. This is done in terms of ‘Sujudus-Sahwi’. But like in Salat, the forgetfulness in Ramadan involves neither drunkenness nor sexual intercourse nor cheating of any kind.
As a Muslim, you are not supposed to eat any forbidden food or drink any intoxicant in the first place, Ramadan or no Ramadan. To be drunk, therefore, in Ramadan, under the pretext of forgetfulness is a confirmation of hypocrisy or infidelity.
As for sexual intercourse which should only occur legitimately between a husband and his wife, it is impossible to be done out of forgetfulness. At least if the husband cannot remember Ramadan, the wife should. Sexual intercourse cannot be done unconsciously.
But if intercourse occurs in your dream and you suddenly wake up to discover that you are already wet, all you need to do is to clean up with Janabah (purification) bath. And, then, you continue your fast.
Fasting, especially in Ramadan, is a means of rejuvenating spiritual consciousness and renewal of good intention. Anyone who breaks his/her fast in error due to forgetfulness should immediately repent and abstain from any situation that can cause its repetition. Allah is forgiving and merciful.