In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
[وَقَالَ فِرۡعَوۡنُ ٱئۡتُونِى بِكُلِّ سَـٰحِرٍ عَلِيمٍ۬ -And Fir’aun (Pharaoh) said: “Bring to me every well-versed sorcerer]; meaning: ”Everyone who is proficient in magic; magicians who can perform different types of magic and are at different levels of proficiency in their field”. So when the magicians arrived to defeat Moosaa and Haaroon, Allaah says that Moosaa said to them: [أَلۡقُواْ مَآ أَنتُم مُّلۡقُونَ-Cast down what you want to cast!]; Moosaa said this to them because he did not care about what they were going to do first, for he was certain that he will defeat them and nullify their falsehood (by the aid of Allaah). So after they threw their ropes, which appeared as serpents in the eyes of the people, Allaah says that Moosaa said to them:
مَا جِئۡتُم بِهِ ٱلسِّحۡرُۖ إِنَّ ٱللَّهَ سَيُبۡطِلُهُ ۥۤۖ إِنَّ ٱللَّهَ لَا يُصۡلِحُ عَمَلَ ٱلۡمُفۡسِدِينَ
“What you have brought is sorcery, Allah will surely make it of no effect. Verily, Allah does not set right the work of Al-Mufsidun (the evil-doers, corrupts, etc.); meaning: Indeed, you want to aid falsehood against truth and Allaah will nullify your actions.
This will also be the case with every corrupter- the one who uses tricks, devices plots and evil plans- for indeed his deeds will be of no effect. And even if he has weapons to aid him pursue his goal at a particular time period, however the end result will be nothing for him and Allaah will make the truth apparent. As for those who do righteous deeds for the sake of Allaah -deeds that are based on the beneficial ways and are based on what Allaah has commanded- then indeed Allaah will bless their deeds, make them bear righteous end results and make them remain (as a source of good for themselves & an example for others to follow).
So when Moosaa threw his staff, it became a real serpent and swallowed all the ropes that were thrown by the magicians and made to look like serpents in the eyes of the people, and thus their magic was nullified and their falsehood obliterated.
Allaah [The Most High] says: [وَيُحِقُّ ٱللَّهُ ٱلۡحَقَّ بِكَلِمَـٰتِهِۦ وَلَوۡ ڪَرِهَ ٱلۡمُجۡرِمُونَ – And Allah will establish and make apparent the truth by His Words, however much the Mujrimun (criminals, disbelievers, polytheists, sinners, etc.) may hate it].
After the magicians witnessed the truth, they prostrated (in repentance to Allaah); so Fir’awn threatened them – that he will crucify them, and cut their hands and legs, but they gave no concern to Fir’awn’s threats; rather they remained steadfast upon their Eemaan. As for Fir’awn and his chiefs, then not a single one of them believed, rather they persisted upon transgression, and this is why Allaah [The Most High] says:
فَمَآ ءَامَنَ لِمُوسَىٰٓ إِلَّا ذُرِّيَّةٌ۬ مِّن قَوۡمِهِۦ عَلَىٰ خَوۡفٍ۬ مِّن فِرۡعَوۡنَ وَمَلَإِيْهِمۡ أَن يَفۡتِنَهُمۡۚ وَإِنَّ فِرۡعَوۡنَ لَعَالٍ۬ فِى ٱلۡأَرۡضِ وَإِنَّهُ ۥ لَمِنَ ٱلۡمُسۡرِفِينَ
But none believed in Musa (Moses) except the offspring of his people, because of the fear of Fir’aun (Pharaoh) and his chiefs, lest they should persecute them; and verily, Fir’aun (Pharaoh) was arrogant tyrant on the earth, he was indeed one of the Musrifun (polytheists, sinners and transgressors, those who give up the truth and follow the evil, and commit all kinds of great sins).
[فَمَآ ءَامَنَ لِمُوسَىٰٓ إِلَّا ذُرِّيَّةٌ۬ – But none believed in Musa (Moses) except the offspring of his people]; Meaning: The youth amongst Bani Israa’eel, who exercised patience due to the Eemaan that was firmly established in their hearts, whilst being in a state of fear because Fir’awn had complete authority and power in the land, so it is expected that he will seek to punish them, for he was an extreme transgressor.
And the wisdom -and Allaah knows best- behind the fact that only the offspring of Moosaa’s people believed in Moosaa, is because the offspring- the youth- are more likely to accept the truth and quicker to submit to it, as opposed to the old people and those similar to them – those who were brought up in a religion of disbelief, for indeed due to the corrupt creed that is established in their hearts, they are the ones most likely not to accept the truth.
[Source: An Excerpt from ‘Tayseer Al-Kareem Ar-Rahmaan Fee Tafseer Kalaam Al-Mannaan’ by Imaam As-Sadi (rahimahullaah)]