When the Prophet ﷺ set out for Uhud, Some men among his companions turned back. One group said, "Let us kill them." Another group said, "Let us not kill them." Then the verse was revealed, "What is the matter with you that you are divided into two groups regarding the hypocrites?" [Nisa 4:88].The Prophet ﷺ said, "It expels the wicked just as fire expels the impurities of iron."
لما خرج النبي ﷺ إلى أحد، رجع ناس من أصحابه. فقالت فرقة: نقتلهم. وقالت فرقة: لا نقتلهم. فنزلت {فما لكم في المنفقين فئتين}. وقال النبي ﷺ: إنها تنفي الرجال كما تنفي النار خبث الحديد.
Bukhari narrated it in Fadail al-Sahabah (1884), and Muslim in Hajj (1384), both from the hadith of Shubah, from Adi bin Thabit, from Abdullah bin Yazid, who said, "I heard Zayd bin Thabit," and he mentioned it. The wording given is Bukhari's, while Muslim's wording is abridged.As for His saying, "Allah cast them back for what they earned" [Nisa 4:88], it means He caused them to fall into error. It has also been said it means He destroyed them, "for what they earned" meaning because of their disobedience and their opposition to the command of the Messenger of Allah ﷺ.