As a man who was according to God's heart, David knew that God desired to have His own home. Hence, David desired to remove the ark from the house of Abinadab to Zion, the city of David (2 Sam. 6:1-10).
The ark of God was removed from the house of Abinadab, and David and all the house of Israel played on musical instruments before Jehovah (vv. 1-5). That was a most joyful occasion because God was moving from a guest house to His own lodging.
The people of Israel, perhaps influenced by the Philistines, moved the ark by means of a cart. The ark should have been borne by the Levites (1 Chron. 15:2). God did not condemn the worldly Philistines for using a cart to move the ark, but He would not tolerate the same action by His people. Under God's sovereignty the oxen stumbled at Nachon's threshing floor, and Uzzah, having a good intention, reached out for the ark of God and took hold of it (2 Sam. 6:6). Instantly, he was killed. "The anger of Jehovah was kindled against Uzzah, and God struck him there for his error; and he died there by the ark of God" (v. 7). The natural hand, the hand of man, touching something divine brought in God's anger.
The death of Uzzah frightened David very much, and he did not want to remove the ark of God to himself in the city of David. Instead, he carried it into the house of Obed-edom the Gittite (vv. 9-10), where it stayed for three months.