14 David was staying in the stronghold at the time, and a Philistine detachment had occupied the town of Bethlehem. 15 David remarked longingly to his men, "Oh, how I would love some of that good water from the well by the gate in Bethlehem." 16 So the Three broke through the Philistine lines, drew some water from the well by the gate in Bethlehem, and brought it back to David. But he refused to drink it. Instead, he poured it out as an offering to the Lord . 17 "The Lord forbid that I should drink this!" he exclaimed. "This water is as precious as the blood of these men who risked their lives to bring it to me." So David did not drink it. These are examples of the exploits of the Three.
Matthew Henry's Commentary on 2 Samuel 23:14-17
Commentary on 2 Samuel 23:8-39
(Read 2 Samuel 23:8-39)
David once earnestly longed for the water at the well of Bethlehem. It seems to be an instance of weakness. He was thirsty; with the water of that well he had often refreshed himself when a youth, and it was without due thought that he desired it. Were his valiant men so forward to expose themselves, upon the least hint of their prince's mind, and so eager to please him, and shall not we long to approve ourselves to our Lord Jesus, by ready compliance with his will, as shown us by his word, Spirit, and providence? But David poured out the water as a drink-offering to the Lord. Thus he would cross his own foolish fancy, and punish himself for indulging it, and show that he had sober thoughts to correct his rash ones, and knew how to deny himself. Did David look upon that water as very precious which was got at the hazard of these men's blood, and shall not we much more value those benefits for purchasing which our blessed Saviour shed his blood? Let all beware of neglecting so great salvation.