ANSWER: Before we delve into why David had to wait before ruling over a unified Israel, we need to know how long was the waiting period. He was the youngest of eight sons of Jesse the Bethlehemite, is anointed king by the prophet Samuel (1Samuel 16:1 - 3). While the historian Josephus says that he was ten years old when anointed, modern commentaries place the age at around fifteen. He began to rule when the tribe of Judah asked him to reign over them when he was about thirty years old. After about seven and one-half years the remaining tribes of Israel acknowledge him as the sole King. Conservatively, therefore, the period between when he was anointed and the time he actually began to officially rule was fifteen years.
King David, like the rest of us, suffered most of his life because of his own sins (adultery with Bathsheba, murder of Uriah her husband, and generally not disciplining his children). However, the long waiting to rule had little to do with the sins of his fathers. Rather, before God blesses someone or gives them authority of any kind, He tests them over a period of time to see if they will be worthy of the blessing or calling. God looks on the heart of man and not on the outward appearance, as he reiterated to Samuel when he was told to anoint a new king.
1. And the LORD said to Samuel, "How long will you mourn for Saul since I have rejected him from reigning over Israel? Fill your horn with oil and go. I will send you to Jesse of Bethlehem, for I have seen a king for Me among his sons."
6. And it came to pass as they came in, he (Samuel the prophet) saw Eliab (firstborn son of Jesse) and said, "Surely the LORD'S anointed is before the LORD." 7. But the LORD said to Samuel, "Do not look on his face, nor on his height because I have refused him, for the LORD does not see as man sees; for man looks on the outward appearance, but the LORD looks on the heart" (1Samuel 16:1, 6 - 7, HBFV)
God tested David during the fifteen years between the time of his anointing and him officially assuming the reigns of power. He was almost continually taunted and harassed by Saul. God eventually concluded that He should not have chosen Saul to be ruler over his people because he was not obedient to his commands.
God's proving and refining of his character before he began to reign led to him being faithful to the Eternal all the days of his life. Jesus, through his mother Mary, not only traces his bloodline back to the second king of Israel, he will also assume his throne at his Second Coming (Luke 1:32 - 33). David himself, after he is resurrected from the dead, will rule over the tribes of Israel in the coming new world under Christ (see Ezekiel 37).