23 his corpse must not remain all night upon the tree; you shall bury him that same day, for anyone hung on a tree is under God's curse. You must not defile the land that the Lord your God is giving you for possession.

Matthew Henry's Commentary on Deuteronomy 21:23

Commentary on Deuteronomy 21:22-23

(Read Deuteronomy 21:22-23)

By the law of Moses, the touch of a dead body was defiling, therefore dead bodies must not be left hanging, as that would defile the land. There is one reason here which has reference to Christ; "He that is hanged is accursed of God;" that is, it is the highest degree of disgrace and reproach. Those who see a man thus hanging between heaven and earth, will conclude him abandoned of both, and unworthy of either. Moses, by the Spirit, uses this phrase of being accursed of God, when he means no more than being treated most disgracefully, that it might afterward be applied to the death of Christ, and might show that in it he underwent the curse of the law for us; which proves his love, and encourages to faith in him.