This question highlights the importance of considering the whole of Scripture rather than cutting and pasting one or two verses to resolve a theological dilemma.
Although two specific verses in a few translations record Jesus emphasizing prayer and fasting (Matthew 17:21 and Mark 9:29), many Bible scholars insist these verses should be regarded as erroneous (or at least extraneous) because New Testament manuscripts now considered to be more accurate don't depict our Redeemer saying that certain prayers won't be answered if our tummies aren't growling.
While fasting is an important part of discipleship (after all, Jesus fasted 40 days before he began his public ministry), Jesus actually warns about the potential dangers associated with fasting more often than he endorses the activity.
What Does God Say About This?
When some men asked Jesus why his disciples didn't fast, our Savior equated fasting with sorrow and essentially said his boys wouldn't mourn until he left the proverbial building: "Can you make wedding guests fast while the bridegroom is with them?" (Luke 5:34, esv). In the Sermon on the Mount, Jesus cautions people about distorting the private discipline of fasting to get a public pat on the back: "And when you fast, do not look gloomy like the hypocrites, for they disfigure their faces that their fasting may be seen by others. Truly, I say to you, they have received their reward. But when you fast, anoint your head and wash your face, that your fasting may not be seen by others but by your Father who is in secret. And your Father who sees in secret will reward you" (Matthew 6:16-18, esv).
Furthermore, long before Jesus advised his followers against fakey-fasting, God the Father reprimanded the Israelites about it: "They act like a righteous nation that would never abandon the laws of its God… . 'We have fasted before you!' they say. 'Why aren't you impressed? We have been very hard on ourselves, and you don't even notice it!' 'I will tell you why!' I respond. 'It's because you are fasting to please yourselves. Even while you fast, you keep oppressing your workers. What good is fasting when you keep on fighting and quarreling? This kind of fasting will never get you anywhere with me'" (Isaiah 58:2-4, nlt).
Of course, many examples in Scripture reveal abstaining from eating (the literal definition of the Greek word rendered "to fast" in the New Testament) for spiritual reasons in a positive light: when the Jews obediently fasted to observe the Day of Atonement according to Old Testament law (Leviticus 16:29); when Daniel fasted while repenting on behalf of God's people (Daniel 9:3-19); when Anna, an octogenarian female prophet, fasted while loitering around the Temple hoping to meet the newborn Messiah (Luke 2:36-38); when Jesus fasted for 40 days while Satan tempted him in the desert (Matthew 4:1-11); and when faithful leaders in early church history fasted (Acts 13:2-3, 14:23). Which means fasting with a pure heart can be an effective way to humble ourselves and honor God during seasons of intense prayer and worship.