Young David is not the only great leader of the Children of Israel who was a shepherd before Hashem called him to a leadership role. For example, Moshe was also a shepherd. Shepherds bear great responsibility for the flock as a whole, and also for each individual sheep. Each one must be cared for, and must be counted as part of the flock for tithing. This is perfect training for leaders, who must lead the nation as a whole, and also maintain concern and compassion for each individual. Serving from the young age of 18, IDF soldiers are like shepherds, bearing great responsibility for keeping each and every citizen safe as well as protecting Israel as a whole.
Source: Israel in the News