The Purpose of Fasting
the ultimate goal of the fast is to develop taqwa (consciousness of god) in people, as allah said:
"….so that it may produce taqwa in you."
[noble quran 2:183]
taqwa is among the highest moral qualities that a muslim can attain. it is produced by placing a shield between one's self and allah's wrath, as the root meaning of the word implies (i.e. taqwa comes from the verb waqaa, which means "to safeguard"). this is achieved by being conscious of allah and all his commandments at all times, which means avoiding the haram (prohibited) as well as the makruh (undesirable) and even some of the halal (permissible) wherever doubt arises.