We know that the majority of scholars say if anyone leaves the religion of Islam the punishment is death but according to this hadith he pardoned them can you explain this hadith?
Narrated Jabir: that a Bedouin gave the pledge to the Messenger of Allah (ﷺ) for Islam, then he was afflicted by the sickness in Al-Madinah. So the Bedouin went to the Messenger of Allah (ﷺ) and said: "Take back my pledge." But the Messenger of Allah (ﷺ) refused. Then the Bedouin left and came back and said: "Take back my pledge," and he refused. Then the Messenger of Allah (ﷺ) said: "Al-Madinah is but like bellows, it expels its filth and purifies its good."
Grade : Sahih (Darussalam)
English reference : Vol. 1, Book 46, Hadith 3920
Arabic reference : Book 49, Hadith 4299