Parallel passage is 1 Chronicles 21.
David numbers the people. (1-9):
V. 1: …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 gSatan 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 choice to choose one.
1. Three years of famine come to you in your land.
2. Flee three months before your foes while they pursue you.
3. Three days’ pestilence in your land.
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.