Parallel passage is 1 Chronicles 21. David numbers the people. (1-9):
V. 1: … Again the anger of the Lord was kindled against Israel, and he incited David against them, saying, “Go, number Israel and Judah.”
1 Chronicles 21:1 Then Satan stood against Israel and incited David to number Israel.
Who did it… God or Satan? (Below 4 paragraphs are taken from ESV Study Bible)
Gen. 50:18–21; Joseph stresses that God transformed their evil into good and that as a result, many people have been kept alive. This principle that God ultimately overrules human sin for his glory and the ultimate good of mankind is important in Scripture… Joseph’s gracious, forgiving attitude unites the family. Like the lives of Jacob and Esau, Joseph’s life was marred by deadly hatred between brothers. In both cases the story ends with the offended brother’s offering full forgiveness to those who had mistreated him (Gen. 33:4).
Mark 14:21: Jesus confirms that the Son of Man goes as it is written (cf. Ps. 55:13–14; Isa. 53:1–12; Dan. 9:25–26; Mark 8:31). but woe to that man. Despite the fact that the Scriptures have predicted that Jesus would suffer a substitutionary death, Judas is responsible for his evil deed. This is one of many scriptures that simultaneously affirm God’s sovereign ordering of events and also human responsibility for those events.
Acts 2:23: Peter combines a clear affirmation of God’s sovereignty over world events and human responsibility for evil deeds. Although Jesus was delivered up according to the definite plan and foreknowledge of God, showing that God had both foreknown and foreordained that Jesus would be crucified, that still did not absolve of responsibility those who contributed to his death, for Peter goes on to say, “you crucified and killed” him. Though one may not understand fully how God’s sovereign ordination of events can be compatible with human responsibility for evil, both are clearly affirmed here and in many other passages of Scripture (cf. notes on 3:13–16; 3:17; 4:27; 4:28). by the hands of lawless men. Peter also places responsibility on the Gentile officials and soldiers who actually crucified Jesus.
2 Tim. 2:10: endure … for the sake of the elect. While there is disagreement among Christians on the doctrine of election, a biblical understanding of the doctrine does not undercut mission work but enables it. Paul endures precisely because of a certainty that, through his ministry, God will save some.
1. God does not cause anyone to sin. – James 1:13
2. God allowed satan to influence David to do what David probably already had in his heart to do. James 1:14,15.
3. It may be a sin of motive. David might have started trusting more in his military strength than in God’s Power (V. 3). Ps. 20:7.
4. It might be a sin of method. Exodus 30:11-16 has a reference to the need for a “ransom” after the counting.
5. God’s sovereign will and human responsibility (ESV Study Bible Notes).
He chooses the pestilence. (10-15):
It is well, when a man has sinned, if he has a heart within to smite him for it. If we confess our sins, we may pray in faith that God would forgive them, and take away, by pardoning mercy, that sin which we cast away by sincere repentance…. In this difficulty, David chose a judgment which came immediately from God, whose mercies he knew to be very great, rather than from men, who would have triumphed in the miseries of Israel, and have been thereby hardened in their idolatry. He chose the pestilence; he and his family would be as much exposed to it… The rapid destruction by the pestilence shows how easily God can bring down the proudest sinners…,. – Mathew Henry Commentary.
V.10: …I have done very foolishly…: David realized that considering Israel’s strength on the strength of men as the other nations would. This is to violate Israel’s relationship with Yahweh who was her true strength. Important thing to note here is that David’s heart was so sensitive towards the LORD. He quickly convicted and repented.
V.13: …consider, and decide…: David was given three choices to choose one.
1. Three years of famine come to you in your land. (1 Chronicles 21:12 mentions as 3 years)
2. Flee three months before your foes while they pursue you.
3. Three days’ pestilence in your land.
These 3 plagues infer that the LORD was not only displeased with the king, but He was displeased with the nation also.
V.14: … Let us fall into the hand of the Lord …: David chose to fall into the hands of God, because God is merciful.
The staying the pestilence. (16 & 17):
V. 16 & 17…Angel stretched out his hand…indicates the supernatural nature of the plague. …let your hand, I pray, be against me: …sign of a true penitence is always willing to take responsibility for the effects of his sin. And, in David is the spirit of a true shepherd of the people, offering himself as a sacrifice to God, for the salvation of his subjects.
David’s sacrifice, The plague removed. (18-25):
V.18: …go up… There was about 412 meter higher place from David’s house. …the threshing floor of Araunah, the Jebusite … Jerusalem was originally inhabited by Jebusites and there were still some Jebusites living in Jerusalem until and during David’s time (2 Samuel 5: 6 & 7). This is the place where Abraham offered Isaac (Gen. 22:2) and this became the location for Solomon’s Temple (2 Chronicles 3:1).
1 Chronicles 21: 20 & 21…Ornan turned and saw the angel… (Araunah is called as Ornan in 1 Chronicles). Ornan saw the destroying angel and then David in verse 21.
V.24: …Fifty shekels of silver…: There seems to be a discrepancy between this reference and 1 Chro. 21:25 which says 600 Shekels. But a closer look at both references 2 Samuel talks about the buying the threshing floor and oxen for 50 shekels of silver whereas 1 Chronicles 21:25 talks about purchasing the entire site that was later used to build the Temple.
V.25: David…offered burnt offerings and peace offerings: God accepted the burnt offerings and the peace offering made David to enjoy the presence of the LORD. 1 Chronicles 21:26 gives us more details about how the LORD answered with fire from heaven which generally signifies God’s approval of the site, especially in this last encounter of David with God. In chapter 23, David, who was already a KING, functions as a PROPHET, and here he functions as PRIEST. Thus he foreshadowed Jesus’ 3 fold ministry of PROPHET, PRIEST, AND KING.
1 Chron. 21:28–22:1: This material is not found in 2 Samuel 24. It explains why David did not go to Gibeon to offer a sacrifice and why he concluded that God had authorized the transfer of that sanctuary to the new site in Jerusalem (see 2 Chron. 1:3–6; 5:5). – ESV Study Bible Notes.