"His body shall not remain all night upon the tree"Deuteronomy 21:23.

It is forbidden to leave a corpse that was hung by the courts hanging overnight.

This because only two offenses are punishable by hanging [post execution]: idolatry and blasphemy. As such, someone seeing the hanging corpse might contemplate the reason why the individual was hanged, and will come to blaspheme G‑d in his thoughts.

[This prohibition also includes leaving any Jewish corpse unburied overnight, unless the delay in the internment is in honor of the deceased; e.g., to allow time for relatives to arrive for the funeral.]