In testimony of their innocency. See Poole on "Matthew 27:24".
Related Commentaries of Deuteronomy 21:6
Deuteronomy 21:6
6 And all the elders of that city, that are next unto the slain man, shall wash their hands over the heifer that is beheaded in the valley: