And David’s heart condemned him after he had numbered the people. So David said to the Lord, “I have sinned greatly in what I have done; but now, I pray, O Lord, take away the iniquity of Your servant, for I have done very foolishly.” 2 Samuel 24:10
David counts his people. Sometime during his reign, David takes a census. This is viewed even by David’s military commanders as a sin, possibly because the act suggests confidence in numbers rather than the Lord. At this time, possibly in the midpoint of his rule, 1,300,000 fighting men are available. This high proportion of them in Judah (500,000) makes it clear that the tribe of Simeon and part of Dan, are also included in “Judah,” just as a number of northern tribes are called “Israel.”
God judges this sin, but gives David a choice of national punishments. The plague which David chooses is stopped just outside of Jerusalem. There David builds an altar and offers sacrifices.
This place will become the site of Solomon’s temple and all other temples built in Jerusalem. It is the same place where Abraham was about to offer up Isaac (Gen. 22). It is the place that prophecy says a rebuilt temple will stand in Messiah’s day (Ezek. 40-48).
18 And Gad came that day to David and said to him, “Go up, erect an altar to the Lord on the threshing floor of Araunah the Jebusite.” 19 So David, according to the word of Gad, went up as the Lord commanded. 20 Now Araunah looked, and saw the king and his servants coming toward him. So Araunah went out and bowed before the king with his face to the ground. 21 Then Araunah said, “Why has my lord the king come to his servant?” And David said, “To buy the threshing floor from you, to build an altar to the Lord, that the plague may be withdrawn from the people.” 22 Now Araunah said to David, “Let my lord the king take and offer up whatever seems good to him. Look, here are oxen for burnt sacrifice, and threshing implements and the yokes of the oxen for wood. 23 All these, O king, Araunah has given to the king.” And Araunah said to the king, “May the Lord your God accept you.” 24 Then the king said to Araunah, “No, but I will surely buy it from you for a price; nor will I offer burnt offerings to the Lord my God with that which costs me nothing.” So David bought the threshing floor and the oxen for fifty shekels of silver.