The magicians of Fir'awn were all defeated. The false snakes they produced by their sticks were all swallowed by the serpent of Musa's (S.A.W.) stick. Fir'awn and his magicians could hardly believe and the magicians bowed to the truth and professes their faith in Allah (S.W.T.), Sura Ash-Shu'araa (26:38-51)
So, the magicians were gathered together on an appointed day and time, and the people were asked, "Would you come to the gathering? We may perhaps still follow the magicians' way if they are dominant," When the magicians arrived for the contest, they said to pharaoh, "Shall we have rewards if we win?"
Pharaoh replied: "Of course, and then you will be included among those nearest to me."
Musa (S.A.W.) said: "Cast down what you have to cast down." They forthwith cast down their cords and staffs and said, "By Pharaoh's honour, we shall surely win." Then Musa (S.A.W.) cast down his staff, and lo ! it started devouring up their false devices. At this, all the magician fell down in prostration, and cried out, "We have believed in the Lord of all creation the Lord of Moses and Aaron [Musa (S.A.W.) and Harun (S.A.W.) !"
Pharaoh said: "You have believed in Moses (P.b.u.h.) even before I should have permitted you ! He must be your chief who has taught you magic. Well, you shall soon come to know: I shall have your hands and feet cut off on opposite sides and shall crucify you all."
They replied, "We care not: we shall pass into our Lord's presence, and we expect that our Lord will forgive us our sins because we are the first to believe."
Because of this, Fir'awn became angry and started to torture the Bani Isra'il. It was during this time that Allah (S.W.T.), commanded Musa (S.A.W.) to leave Egypt with his followers, Sura Taha (20:77)
We sent this Revelation to Musa (S.A.W.): "Set forth with My servants during the night and make for them a dry path across the sea. Have no fear of being overtaken nor be afraid (while passing through the sea)."
Musa (S.A.W.) asked his followers to get ready and set out at night to avoid Fir'awn's notice and reached the shore of Nile. They were chased by Fir'awn's soldiers when they almost reache Israelites. At this moment, Allah (S.W.T.) , ordered Musa (S.A.W.) to throw the stick in the water and he did so, the Nile was thendivided into two and appeared a road in the middle ready, allowing the Israelites to cross it Sura Ash-Shu'araa (26:52-66)
We inspired Musa (S.A.W.) with this, "Set off with My servant by night, for you will be pursued." At this,Pharoah sent out heralds to the cities (for mobilization, saying) : "These are but a handful of people, who have provoked us much; and we are always on our guard." Thus did We draw them out from their gardens and their water-springs and their treasure-houses and fine dwellings. This is how they were dealt with, while (on the other hand) We made the Children of Israel inherit all these things.
In the morning these people set out in pursuit of them. When the two hosts came face to face with each other, the companions of Musa (S.A.W.) cried out: "We are overtaken!" Musa (S.A.W.) said: "No, never! With me indeed is my Lord: He will surely guide me." We inspired Musa (S.A.W.) with the Command: "Smite the sea with your staff." The sea parted forthwith and its each part stood like a mighty mountain. And We led to the same place the other host, too. We saved Musa (S.A.W.) and all his companiions, and drowned the others.
Fir'awn and his soldier were following but, when the Israelites reached the other shore, while Fir'awn was still in the middle of Nile, water from both sides suddenly poured in and the road dis-appeared. Fir'awn and his soldiers were drowned there. So this how Allah (S.W.T.), punishes the trangressors and helps His faitful servants.