Ever since the Garden of Eden, a serpent has been a sign of sin/evil.
Jesus never sinned in His life. But when He hung on the Cross, He became sin for us.
At that moment, God had to turn His back on His Son because all the sins and sicknessess of the world were nailed to Jesus' body.
Judgment fell on Him instead of on us!