فَاسْتَجَبْنَا لَهٗ فَكَشَفْنَا مَا بِهٖ مِنْ ضُرٍّ وَّاٰتَيْنٰهُ اَهْلَهٗ وَمِثْلَهُمْ مَّعَهُمْ رَحْمَةً مِّنْ عِنْدِنَا وَذِكْرٰى لِلْعٰبِدِيْنَ ۚ ( الأنبياء: ٨٤ )
Fastajabnaa lahoo fakashaf naa maa bihee min durrinw wa aatainaahu ahlahoo wa mislahum ma'ahum rahmatam min 'indinaa wa zikraa lil'aabideen (al-ʾAnbiyāʾ 21:84)
So We responded to him and removed what afflicted him of adversity. And We gave him [back] his family and the like thereof with them as mercy from Us and a reminder for the worshippers [of Allah]. (Al-Anbya  : 84)
1 Mufti Taqi Usmani
So, We answered his prayer and removed whatever pain he had, and gave him (back) his family and the like thereof along with them, as a mercy from Our own Self and as a lesson for the worshippers.