Fasting is also prescribed as an obligatory duty of Islam and the Muslim is obliged to fast from sunrise to sunset during the thirty days of the month of Ramadan, considered as the sultan of the twelve months in the Islamic calendar. The command to fast is found in the Qur'an:
Ramadan is the (month) in which was sent down the Qur'an, as a guide to mankind, also clear (Signs) for guidance and judgment (between right and wrong). So every one of you who is present (at his home) during that month should spend it in fasting. But if any one is ill, or on a journey, the prescribed period (should be made up) by days later. Surah 2.185
The believer must declare his niyyah (niyet) before dawn each day and must abstain from all foods, liquids and other pleasures (like smoking, sex etc.) during the day. He should partake of a proper breakfast before the morning prayer. At sunset he should also break his fast as soon as he can. The fast-month ends with the sighting of the new moon heralding the month of Shawwal and the Eid festival (bayram).
Abd Allah b. Abbas reported that the Apostle of Allah, Muhammed (may peace be upon him), referring to Ramadan, declared: Do not begin to fast until you have seen the crescent and do not leave the fast until you see it, and if there are clouds, complete thirty days. (Muwatta Imam Malik, p.116).
Throughout the Muslim world this fast, although commanded only once in the Qur'an, is rigidly observed, even by those who are otherwise lax in religious observances. In conclusion it may be said that Salaah and the Ramadan fast have a greater effect on the Muslim's religious consciousness than all the other prescribed duties of Islam.
Fasting in Ramadan teaches people to get ready for the bad days (like wars, food or water shortage etc.) and makes them understand how the poor people feel when they have hunger.