14 While David was holed up in the Cave, the Philistines had their base camp in Bethlehem 15 David had a sudden craving and said, "Would I ever like a drink of water from the well at the gate of Bethlehem!" 16 So the Three penetrated the Philistine lines, drew water from the well at the gate of Bethlehem, and brought it back to David. But David wouldn't drink it; he poured it out as an offering to God, 17 saying, "There is no way, God, that I'll drink this! This isn't mere water, it's their life-blood - they risked their very lives to bring it!" So David refused to drink it. This is the sort of thing that the Three did.
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.