Yahweh established a covenant with King David, known as the Davidic Covenant, in which the "house" of David would continually reign over God's people.
2 Samuel 7:12–17 (NKJV)
When your days are fulfilled and you rest with your fathers, I will set up your seed after you, who will come from your body, and I will establish his kingdom. He shall build a house for My name, and I will establish the throne of his kingdom forever. I will be his Father, and he shall be My son. If he commits iniquity, I will chasten him with the rod of men and with the blows of the sons of men. But My mercy shall not depart from him, as I took it from Saul, whom I removed from before you. And your house and your kingdom shall be established forever before you. Your throne shall be established forever."'" According to all these words and according to all this vision, so Nathan spoke to David.
God delivered His people from the hand of Egypt, and they settled in the land of Canaan (the Promised Land). However, as they settle in this new land, they desired to be like the nations around them and demand a king (1 Samuel 8). Israel rejects the leadership of God, as they begin forgetting the covenant at Mt. Sinai. Saul is selected as king over Israel. Saul, like Israel, fails to honor and keep God's word, and Saul is eventually rejected by God as Israel's king (see: 1 Samuel 15 - 16:11).
Over the downfall of king Saul, God appoints David, an unlikely shepherd, to become king of Israel (1 Samuel 16). David becomes a successful and great king. He defeats the enemies of Israel and unites the kingdom (2 Samuel 5:1-3).
As David dwells in his house, he wants to build a house for God so that God can dwell with His people Israel (see: 2 Samuel 7). God responds by making a covenant with David. David's name will be great, and God will raise a descendant from David in whom God would establish His kingdom forever (ref. 2 Samuel 12-13).
God is working to fulfill His purposes through the covenant narratives of Noah, Abraham, Moses, and David. God's covenant with David leaves readers and Israel looking forward to a future king and deliverer who is like David.
Where people fail to keep their covenant promises, God's promises will ultimately be fulfilled through His Son, Jesus.
Unless otherwise noted, Scripture taken from the New King James Version®. Copyright © 1982 by Thomas Nelson. Used by permission. All rights reserved.
Article: PDF download
BibleProject: Theme Video - The Covenants