God's ultimate call on David's life was for him to be the king of Israel. But in the meantime there were still one or two little things he could do.
We meet up with him living life pretty much as he did before Samuel anointed him king. He's still the youngest and he's at home watching the sheep when his brothers are called to help fight the Philistines. And he's still the one who dad tells to run out to the battlefront and see what's going on. The bible doesn't say this, but I'm pretty sure that after Jesse said, "Check up on your brothers," he said it was because "We haven't heard from them and your mother is worried."
When visiting, David sees the daily ritual of Goliath of Gath coming out to challenge the Israelite armies to a steel cage death match -- no, wait, I mean to one-on-one combat. David is stunned that no Israelite soldier takes up the offer. After all, they serve the Lord, the God of hosts! All Goliath's huge size means is that the near-sighted soldiers have got a shot at him too. He comments on this, and his brothers learn of it. Predictably, their younger brother's foolishness irritates them, because he's just a boy who doesn't know what he's talking about.
David says he'll fight Goliath if no one else will, and he won't be satisfied until King Saul lets him go out to fight. Saul gives him his own armor and weapons, but David says he can't use them because he's not used to them and they weigh him down. I imagine Saul and the others were hoping the heavy armor they think is needed to fight Goliath would convince David he shouldn't make the try. But David will still fight. He heads out and stops to arm himself with five stones for his sling.
Note, if you will, that he takes five stones. I believe he doesn't know exactly how the battle will end. He believes God will triumph, but he doesn't necessarily know exactly how that will happen. As it turns out he overloaded by four stones, but he doesn't know that at the time.
You know the rest. Goliath marches out, laughs at David, gets taunted by David and decides to dispatch him quickly and messily. But David pops him in the melon with a stone from his sling, knocks him down and then decapitates him with his his own sword. Cue the Israelites finding their courage and charging the Philistines, cue the Philistines losing theirs and getting while the getting's good.
Now, in fighting Goliath, David was answering a different kind of call from God. His call to be king one day is specific to him. But like all who followed God, he was called on to trust God and depend on him when facing trouble. So he figured God would be on his side against Goliath, just as God would have been on any Israelite's side if one of them could stop channeling Bert Lahr long enough to remember he was one of God's people.
Did David's decision to answer Goliath's challenge serve God? Yes. Was it foolish? Yes again. But the two in this case go together, and David's rash foolishness served God just as much as his courage and skill with a sling did.
Remember that David is at this point no older than 15 or 16 -- much older than that and he would have been with the soldiers himself. He is, therefore a teenager. What group of people are somewhat prone to acting without thought of the consequences, and when asked later why they made some less-than-optimal decision respond with a shrug and an "I don't know." I believe one such group is made up of teenagers.
We tend to think of teens' impetuous natures as a kind of moral or ethical immaturity, but in reality it has more to do with physical immaturity. The forebrain is the part of the brain that pops up with the "Bad idea, dude" signal when we consider what will turn out to be bad ideas. It does not finish developing until our mid-20s. Of course, there's no guarantee we'll use it once it develops, but before it develops, we really don't use it well at all.
So David's rash decision is exactly the kind of thing we should expect from a young man his age, and the amazing thing is that God uses what we would see as young David's weakness to win the victory. Yes, God uses David's skill with a sling and his speed and his quick thinking to take Goliath when he was down, but before any of that he used David's impulsiveness.
We all like to think God uses our strengths to do his work. If we have caring hearts or keen minds, if we have generous pockets or welcoming spirits -- we believe God uses them for the kingdom and for his glory. But does God use our irritability or our whininess or our laziness or our...well, that's a list that could get long depressingly quickly, couldn't it. The point is that God uses exactly those things for his work as well. God doesn't irritate us or get on our last nerve to make us snappish and then use that irritability, but he will work with whatever he's got to do his will.
After all, he won his greatest victory through the human frailty of his son. Why would we think our own frailties and limitations could hold him back?