It was always the plan of God for Israel to have a king. Deuteronomy 17:14-20 is one of the passages that tells us this, but there are more. As part of the blessing God speaks to Jacob in Genesis 35, He tells him that “kings will be among your descendants” (v. 11). Then there’s talk of the “scepter” and the “ruler’s staff” (which clearly necessitate a king) relative to the tribe of Judah in Genesis 49:10. A king for Israel was always part of God’s plan.
The kingship was tied into Israel’s redemptive purpose as a “kingdom of priests and a holy nation” (Exodus 19:6). Mankind had forfeited their dominion over creation with the sin of Adam and Eve. The nation of Israel was God’s model for the world of what God ultimately intended to do for all humanity through Christ. The monarchy was part of that intent to restore lost dominion as well as to prefigure Christ.
There were also practical considerations for the monarchy. A king would help centralize and unify the fledgling nation. Think of how we still see in some parts of the world continued violence among tribal rulers and warlords. This is the picture of Israel that is painted in the book of Judges (see 9, 12 and 20). Their lack of national cohesion also left them vulnerable to oppression from foreigners (6:13, 10:7, 13:1). We’re familiar with the refrain from Judges that “everyone did as they saw fit” (17:6, 21:25), but the context for it is the observation that “In those days Israel had no king.” Indeed, they did not.
All this explains why, by the time we get to Samuel, Israel wants the right thing (a king), for the wrong reason (so they can be independent). God uses their wickedness to nonetheless accomplish His purposes—just as He did with the cross of Christ (Acts 2:23). It also explains why in Deuteronomy 17, we have clear (if brief) instructions for the king. It was all part of God’s plan for Israel.
In Deuteronomy 17:14-20, God gave instruction through Moses on “How to be a King.” The first requirement was that the king was to be someone chosen by God (v. 15). This would reinforce the truth that the king was meant to be a visible presence of the invisible and ultimate King—Yahweh. The king was also to be an Israelite—from among the Jewish people—someone who was one of them and knew their history, identity, and hopefully would be less likely to introduce idolatry.
To that point and more, he was to immerse himself in God’s word. He was to make a copy of the scroll belonging to the priests (v. 18). That copy was “to be with him” and to be read all the days of his life (v. 19). The purpose of this was that “he may learn to revere the Lord and follow carefully all the words of this law and these decrees” (v. 20).
That was the king God wanted Israel to have and the King we now have in Jesus (Revelation 1:5, 17:14).