The people of Israel were on the point of perishing because of a murmuring against Jehovah and his servant Moses; being bitten by vipers, many of them died in the desert.
"In Egypt, all serpents were sacred and the reincarnation of Apophis; except the cobra, which represented the Sun. The cobra (uraeus), was a symbol of resurrection, being the protective animal of the pharaohs; and in the city of Buto they were venerated for their beneficial character." (Google)
After having witnessed the power of God, with which he gave them freedom from the Egyptian power, the Hebrews were tired of the divine care, granted through the delicious and nutritious heavenly bread; type of the true Bread, Jesus.
They did not accept the manna from heaven as they turned their hearts to Egypt; this being so, the Lord gave them as "bread" one of the pagan worship of this nation: the serpent!
By looking at the bronze viper sculpted by Moses, a modern symbol of medicine, they found salvation from their illnesses.
Numbers 21:7-10 NKJV
7 Therefore the people came to Moses, and said, “We have sinned, for we have spoken against the Lord and against you; pray to the Lord that He take away the serpents from us.” So Moses prayed for the people.
8 Then the Lord said to Moses, “Make a fiery serpent, and set it on a pole; and it shall be that everyone who is bitten, when he looks at it, shall live.” 9 So Moses made a bronze serpent, and put it on a pole; and so it was, if a serpent had bitten anyone, when he looked at the bronze serpent, he lived.
Zechariah 12:10 NKJV
10 And I will pour on the house of David and on the inhabitants of Jerusalem the Spirit of grace and supplication; then they will look on Me whom they pierced. Yes, they will mourn for Him as one mourns for his only son, and grieve for Him as one grieves for a firstborn.
Isaiah 53:4-5 NKJV
4 Surely He has borne our griefs and carried our sorrows; yet we esteemed Him stricken, smitten by God, and afflicted.
5 But He was wounded for our transgressions, he was bruised for our iniquities; the chastisement for our peace was upon Him, and by His stripes we are healed.