Muslims fast to develop patience and piety and also because fasting is obligatory in the month of Ramadan. Muslims believe that fasting is a shield that protects a person from sin and lustful desires.
Fasting teaches a person self-restraint and produces a spiritual state of freedom from want. Fasting is obligatory for all adult Muslims, who are not sick or traveling, in the month of Ramadan. Female Muslims who are having menstruation are exempted from fasting during their menstrual period.
During the fast, besides abstaining from food and drink from the break of dawn to sunset, one should also display good temper and not quarrel with others. During the fast, the Muslim should also perform acts of charity and good work and pray and read the Koran more often. Sexual intercourse during fasting is also forbidden.
Taking a shower, brushing teeth, wearing perfume, having an injection or taking a blood test are permissible activities during the fast, according to IslamiCity. In addition, if one forgets that one is fasting and accidentally takes food or drink during the fast, this does not invalidate the fast as long as the Muslim person stops eating or drinking immediately once he or she remembers. Wikipedia