Why does God hurt innocent people to punish King David? Moreover, even David doesn't understand it, raising the additional problem of why God would give a punishment not understood by the person supposed to be punished.
From the lectionary - January 31, 2018 :
He asked: "Do you want a three years' famine to come upon your land, or to flee from your enemy three months while he pursues you, or to have a three days' pestilence in your land? Now consider and decide what I must reply to him who sent me." David answered Gad: "I am in very serious difficulty. Let us fall by the hand of God, for he is most merciful; but let me not fall by the hand of man." Thus David chose the pestilence. Now it was the time of the wheat harvest when the plague broke out among the people. The LORD then sent a pestilence over Israel from morning until the time appointed, and seventy thousand of the people from Dan to Beer-sheba died. But when the angel stretched forth his hand toward Jerusalem to destroy it, the LORD regretted the calamity and said to the angel causing the destruction among the people, "Enough now! Stay your hand." The angel of the LORD was then standing at the threshing floor of Araunah the Jebusite. When David saw the angel who was striking the people, he said to the LORD: "It is I who have sinned; it is I, the shepherd, who have done wrong. But these are sheep; what have they done?