In these passages is the account of God becoming angry with Israel and orchestrating an event whereby God would punish Israel. God ‘incited David to number Israel.’ I’m not sure why this was a punishable offense, but it was.
God gave David the opportunity to choose one of three punishments. One was to be punished by a famine for seven years. Another was to be punished by David’s enemies for three months. The third was to be punished by a pestilence on Judah and Israel. David chose the pestilence, knowing that God is merciful and might relent of His punishment. The Lord did relent after killing 70,000 of the people from Dan to Beersheba.
It is always best to trust in God and rely on His mercies, for they are great. We must also accept God’s punishment for our sins and have a repentant heart. That is a wise decision, for it will lead to life and will avoid spiritual death.