Let's take a brief look at Daniel and his fasting. The background of the “Daniel fast” is that Daniel and his three friends had been “deported” to Babylon when Nebuchadnezzar and the Babylonians had conquered Judah (2 Kings 24:13-14). Daniel and his three friends were put into the Babylonian court servant “training program.” Part of the program was learning Babylonian customs, beliefs, laws, and practices. The eating habits of the Babylonians were not in complete agreement with the Mosaic Law. As a result, Daniel asked if he and his three friends could be excused from eating the meat (which was likely sacrificed to Babylonian false gods and idols).
The concept of a Daniel fast comes from Daniel chapter 1:8-20 and chapter 10:1-9
8 But Daniel resolved not to defile himself with the royal food and wine, and he asked the chief official for permission not to defile himself this way. 9 Now God had caused the official to show favor and sympathy to Daniel, 10 but the official told Daniel, "I am afraid of my lord the king, who has assigned your food and drink. Why should he see you looking worse than the other young men your age? The king would then have my head because of you." 11 Daniel then said to the guard whom the chief official had appointed over Daniel, Hananiah, Mishael and Azariah, 12 "Please test your servants for ten days: Give us nothing but vegetables to eat and water to drink. 13 Then compare our appearance with that of the young men who eat the royal food, and treat your servants in accordance with what you see." 14 So he agreed to this and tested them for ten days. 15 At the end of the ten days they looked healthier and better nourished than any of the young men who ate the royal food. 16 So the guard took away their choice food and the wine they were to drink and gave them vegetables instead. 17 To these four young men God gave knowledge and understanding of all kinds of literature and learning. And Daniel could understand visions and dreams of all kinds. 18 At the end of the time set by the king to bring them in, the chief official presented them to Nebuchadnezzar. 19 The king talked with them, and he found none equal to Daniel, Hananiah, Mishael and Azariah; so they entered the king's service. 20 In every matter of wisdom and understanding about which the king questioned them, he found them ten times better than all the magicians and enchanters in his whole kingdom. – Daniel 1:8-20Note: Daniel and His friends were obedient to God and God poured out knowledge, understanding, and favor on them.
1 In the third year of Cyrus king of Persia, a revelation was given to Daniel (who was called Belteshazzar). Its message was true and it concerned a great war. The understanding of the message came to him in a vision. 2 At that time I, Daniel, mourned for three weeks. 3 I ate no choice food; no meat or wine touched my lips; and I used no lotions at all until the three weeks were over. 4 On the twenty-fourth day of the first month, as I was standing on the bank of the great river, the Tigris, 5 I looked up and there before me was a man dressed in linen, with a belt of the finest gold around his waist. 6 His body was like chrysolite, his face like lightning, his eyes like flaming torches, his arms and legs like the gleam of burnished bronze, and his voice like the sound of a multitude. 7 I, Daniel, was the only one who saw the vision; the men with me did not see it, but such terror overwhelmed them that they fled and hid themselves. 8 So I was left alone, gazing at this great vision; I had no strength left, my face turned deathly pale and I was helpless. 9 Then I heard him speaking, and as I listened to him, I fell into a deep sleep, my face to the ground. – Daniel 10:1-9Note: Daniel was the only one who fasted and he was also the only one who was able to see the vision. God opened his eyes. Daniel prepared himself and it touched the heart of God.
Related article: The Gift of Fasting