The three warriors broke through the Philistine camp and drew water from the well by the gate in Bethlehem. They took it and brought it to David but he would not drink it and he poured it on the ground to G-d.
The Radak tells us that David did not want to drink the water because his men had risked their lives to obtain it. Drinking it would be like metaphorically drinking their blood because they could have been killed in the attempt. Instead, he poured it out as an offering to G-d, on the ground because there was no altar available.