Was it because he was afraid someone else might die if they touched the ark of the covenant?
12 Now it was told King David, saying, The Lord has blessed the house of Obed-edom and all that belongs to him, on account of the ark of God. David went and brought up the ark of God from the house of Obed-edom into the city of David with gladness. 13 And so it was, that when the bearers of the ark of the Lord had gone six paces, he sacrificed an ox and a fatling. - 2 Sam 6 NASB
12 Now it was told King David, saying, The Lord has blessed the house of Obed-edom and all that belongs to him, on account of the ark of God. David went and brought up the ark of God from the house of Obed-edom into the city of David with gladness. 13 And so it was, that when the bearers of the ark of the Lord had gone six paces, he sacrificed an ox and a fatling. - 2 Sam 6 NASB