بسم الله الرحمن الرحيم
The 2 angels Haarut and Maarut were sent down as a hard test (fitnah) for the Jews of that time because the Jews were already involved in doing black magic. They used to separate husband and wife by black magic and turn the wife’s heart away from her legal husband towards the other man!
This was extreme fall in morality in which they were deeply involved. Then Allah سبحانه و تعالى sent down those two angels in human shape to open an office in market place of black magic. They tried to attract people for doing black magic and although they did magic when demanded from them but they advised every person who came to them for doing magic, to keep away from magic because it is one of the worst evil and those who do and use magic have no place in the Hereafter except Fire.
I am posting the verses 101---103 of surah Al-Baqarah along with the explanation from the Tafheemul Quraan of S. ABUL A’LA MAUDUDI (vol. 1).
(2:101) And whenever a Messenger from Allah came to them, confirming what they already possessed, a party of those who had been given the Scripture flung the Book of Allah behind their backs as if they knew nothing,
(2:102) and then followed what the evil ones falsely attributed to the Kingdom of Solomon104 even though Solomon had never disbelieved; it is the evil ones who disbelieved, teaching people magic. And they followed what had been revealed to the two angels in Babylon – Harut and Marut – although these two (angels) never taught it to anyone without first declaring: “We are merely a means of testing people; so, do not engage in unbelief.”105 And yet they learned from them what might cause division between a man and his wife106. They could not cause harm to anyone except by the leave of Allah, and still they learned what harmed rather than profited them, knowing well that he who bought it will have no share in the World to Come. Evil indeed is what they sold themselves for. Had they but known!
104. 'Evil ones' embraces all evil beings, whether they belong to the human species or to the jinn. Here the reference seems to be to both.
When moral and material decline set in among the Israelites, they were overwhelmed with slavery and ignorance, with misery and poverty, and with humiliation and decadence. They were thus drained of all high ambitions and increasingly turned to magic, sorcery, witchcraft, charms and amulets. They began to search for facile means such as spells that would spare them hard work and yet ensure the achievement of their desired ends. At this stage they were misled by the evil ones, who made them believe that the mighty kingdom and astonishing power of Solomon were merely due to occult sciences and magical formulae, and that by revealing those they would pass on to them the keys to success. People were so engrossed in such practices that they ignored both the Book of God and anyone who summoned them to truth and righteousness.
105. There are various opinions on the interpretation of this verse. My own conclusion is that at the time when the whole Israelite nation was chained in slavery and captivity in Babylonia God sent two angels in human form in order to test the Jews. In the same way as angels were sent to the people of Lot in the form of handsome youths see (Quran 11: 69 ff. - Ed.
), they were presumably sent to the Israelites as saints and religious guides. For this purpose hey might have set up an institution to tech magic and might also be warning everyone who came to learn these things, saying: “ We are holding out these temptations merely for your trial. You should not, therefore, ruin your Hereafter by seeking this knowledge. But in spite of this warning the people came to them in large numbers for talismans, charms and amulets.
It should not surprise anyone that angels came down to earth in human form; angels are dutiful servants of God's kingdom, and are capable of assuming the form appropriate to the specific task they are required to perform at any particular time. Who knows how many angels may be busy performing their duties in our midst even today!
One might also wonder why angels should teach people magic, which is after all intrinsically evil. In order to understand this we must remember that the nature of their task was no different from that of an undercover policeman who hands over marked currency notes to a corrupt official as a bribe with the aim of ensuring that he is caught red-handed.
106. This shows that the greatest demand was for magical arts and charms to sow discord between a man and his wife and to procure the eventual seduction of the latter. This was the depth of moral depravity to which these people had fallen. A people cannot sink to a lower level of moral degeneracy than when adulterous affairs become their favourite pastime, and when seducing a married woman is considered a boastful achievement. The matrimonial relationship is, in truth, the very foundation of man's collective life. The soundness of human civilization depends on the soundness of the relationship between the two sexes. Hence, nothing could be worse than the person who strikes at the very foundations of the structure which supports both him and society as a whole.
There is a Tradition from the Prophet to the effect that Satan sends his agents on their missions to all parts of the world. On their return these agents report their deeds that they have performed. One says that he has created such and such dispute and the other that he has spread chaos and so on, but Satan goes on commenting, “ you have done nothing”. Then comes another one who says, “ I have caused division between a man and his wife.” Satan hugs him and says, “you have indeed done a great deed”. (Bukhari, 'Talaq', 25 - Ed.) In the light of this Tradition it is understandable why the angels who were sent to the Israelites to test them were asked to disclose those magical arts which would lead to separation between a husband and his wife, that was in fact the very standard which could measure accurately their moral degradation.
(2:103) Had they believed and been God-fearing Allah’s reward would have been better! Had they but known!