The subject of prayer and fasting occurs in both Old and New Testaments of the Bible. Indeed, there has been some debate in the medical community about the usefulness of fasting.
Some people have made claims regarding fasting as a means of somehow "cleansing the body." The final verdict, according to modern medical science, is that fasting has little value in the promotion of health. Indeed, if a person fasts for too long, serious physical damage can be done and internal organs may be damaged.
In the Bible, fasting is seen as a way of disciplining the flesh by doing without food and drink for a relatively short period of time. There have been exceptions to this rule: Moses (Exodus 34:28), Elijah (1 Kings 19:8), the Lord Jesus Christ (Matthew 4:1-4) all of whom fasted for 40 days. The Hebrews fasted on the Day of Atonement (Leviticus 16:29,31; 23:27-32; Numbers 29:7). After the return from the Exile, four other annual fasts were observed marking disasters in Jewish history (Zechariah 8:19) and Esther 9:31 may indicate yet another regular period of fasting for the nation of Israel.
Fasting was sometimes used as a means of focusing on the things of the spirit by denying the flesh in order to come closer to God. This was done by individuals and sometimes by the nation as a whole (2 Samuel 12:22; Judges 20:26; Joel 1:14).
Fasting was a way of expressing:
It was also seen as an aid to prayer (Exodus 34:28; Deuteronomy 9:9; 2 Samuel 12:16-23; 2 Chronicles 20:12-23; Ezra 8:21-23)
In the New Testament our Lord seems to expect that his disciples would fast occasionally (Matthew 6:16-18).
Examples of fasting in the New Testament:
In Acts, the leaders of the disciples fast when choosing missionaries and elders (Acts 13:2,3; 14:23).
The Apostle Paul refers to his practice of fasting in 2 Corinthians 6:5; 11:27.
What is the conclusion? Medically, there is not a great deal of physical benefit to fasting and indeed if one is not careful one may do oneself real harm by taking fasting to an extreme. On the other hand, there seems to be a real spiritual benefit to occasional, short-term fasting. It is a way of disciplining the appetites of the flesh and it helps us to focus our minds more clearly on God. Fasting can help to make our prayers more powerful and so strengthen our relationship to our Heavenly Father.
I hope you have found this answer helpful.
May God bless and keep you,