Many significant events occurred during David’s reign, including the move of Israel’s capital to Jerusalem, the expansion of Israel’s territorial boundaries, the transformation of Israel from a tribal confederacy to an imperial power, and the institution of God’s eternal covenant with David (2 Sam. 5:1–10; 7:1–17; 1 Chron. 18). But we would be remiss if we did not include among these events the selection of the location for Israel’s temple.
David’s sin provided the occasion for this decision, as we see in 1 Chronicles 21:1–22:1. It all started when David took a census. In the ancient world, rulers would take a census either to levy taxes or to draft an army, and the counting of men “who drew the sword” indicates that David had the latter purpose in mind. Joab warned David that such a census would be sinful, most likely because it reflected a reliance on human strength in the form of a large standing army. The text also tells us that Joab did not include Levi in the census, “for the king’s command was abhorrent to Joab” (21:6). The best explanation for this is that David asked Joab to include Levites in the army even though the law of God expressly ordered Israel to exclude Levites from a military census (Num. 1). So, it seems that David sinned because he was relying on military strength, not on the Lord, and was breaking God’s regulations for military eligibility.
Note also that the text tells us Satan “incited David to number Israel” (1 Chron. 21:1). Given that the devil is involved in at least some temptations to sin for believers (1 Cor. 7:5), this statement in 1 Chronicles 21:1 is not in itself surprising. However, the parallel account of the event in 2 Samuel 24:1 explains that God incited David to take the census. Here we must understand that both God and Satan were involved, though at different levels. Scripture is clear that God never Himself sins, nor is He ever morally responsible for sin (James 1:13). At the same time, Scripture plainly teaches us that nothing happens apart from God’s sovereign will (Eph. 1:11). So, putting this all together, God ordained this sin but He did so without committing sin Himself. Only David and Satan were blameworthy in the matter of the census.
There is a great deal of mystery here, but let us remember that this is how God works. As with Joseph’s brothers’ sin, what sinners plan and intend for evil, God plans and intends for good (Gen. 50:20). David’s sin would lead finally to the building of the temple.