Imam al-Hasan ibn Ali ibn Abu Talib, peace be upon them, is quoted on p. 49, Vol. 2 of al-Saduq's book Man la Yahdaruhu al-Faqih saying that a group of Jews once visited the Messenger of Allah (S) and the most learned man among them asked him about several issues one of which was: "Why did the Almighty enjoin fast upon your nation during day-time for thirty days after having required previous nations to fast for a longer period of time?"
The Messenger of Allah (S) said: "When Adam ate of the forbidden fruit, food remained in his stomach for thirty days; therefore, Allah enjoined Adam's offspring to spend thirty days suffering from hunger and thirst, and what they eat during this period of time [during the night] is due only to His own favor upon them just as it was His favor upon Adam. This is why Allah enjoined my nation to fast." Then the Messenger of Allah (S) recited this verse:
"Fasting is prescribed for you, as it was prescribed for those before you, so that you may guard (yourselves) against evil. (Fast) for a certain number of days" (Holy Qur'an, 2:182).
The Jew, therefore, said, "You have, O Muhammad, said the truth; so, what is the reward of one who fasts?" The Prophet (S) answered, "No believer fasts during the month of Ramadhan seeking nearness to Allah without the Almighty granting him seven merits:
1) anything haram (prohibited) in his body will be compressed and extracted;
2) he becomes closer to achieving the mercy of Allah;
3) he will have atoned the sin of his father Adam (as);
4) his death agony will be reduced;
5) he will receive an assurance against undergoing the pain of hunger and thirst on the Day of Resurrection;
6) Allah will grant him a clearance from hell; and
7) Allah will feed him of the good things in Paradise." The Jew said, "O Muhammad! You have surely said the truth."
This tradition has been recorded on page 378, Chapter 109, of al-Saduq's book 'Ilal al-Sharai’.
As regarding its types, these vary. They differ according to the differences among the creeds, sects, nations and their respective customs. Its objectives, too, vary, although the most significant of them and the most outstanding is to purify the body and the soul from material and non-material venoms. Among its types is one referred to by the Holy Qur'an as silence and abstention from any vain discourse.
An example is the address of the Almighty to Virgin Mary (as) in which He commanded her, when confronted by others who resented the birth of Christ (as), to say:
"I have surely vowed [to observe] a fast to the Beneficent God, so I shall not speak to anyone today" (Holy Qur'an, 19:26).
Muslims have learned from their Lord, the Praised and the Exalted One, that fast is one of the atonements for: 1) shaving the head during the pilgrimage (while one is still wearing the ihram) due to a valid excuse such as sickness or a head injury, 2) the inability to offer sacrifice (I.e., hadi), 3) killing an ally by mistake, 4) violating an oath, 5) hunting while still wearing the ihram, 6) in the case of zihar.1