What is the purpose behind the creation of angels? Why Allah created them what is their purpose?
first and foremost we must firmly understand and believe that Allah is Al-Ghany: The One who is Self-sufficient, and As-Samad: the One who is free of all needs, who is needed by all His creations.
Allah the mighty and sublime doesn't need any His creations; they are only manifestations of His awe inspiring ability to create and plan. His creations reflect His great and unique abilities. the fact that we humans do not see the complete wisdom in something doesn't mean there isn't any. there are somethings that cannot be logically explained and for such matters all we have is the quran and authentic sunnah.
we are finite as Allah is infinite, our knowledge is limited whereas His knowledge is limitless. When we try to understand more about the creations of Allah and reflect, it becomes a mean for us to know Allah better and become more closer to our creator. when you know/understand the creation you admire the creator.
He knows what is [presently] before them and what will be after them, and they encompass not a thing of His knowledge except for what He wills. [2:255]
now lets look at some of the authentic narrations regarding angels, this should reflect the majesty of the creator.
Jabir b. ‘Abd Allah reported the Prophet (May peace be upon him) as saying : I have been permitted to tell about one of Allah’s angels who bears the throne that the distance between the lobe of his ear and his shoulder is a journey of seven hundred years. [ Sunan Abi Dawud 4727]
Narrated Abdullah : Ibn Masud narrated to us that the Prophet (peace be upon him) had seen Gabriel with six hundred wings. [Sahih al-Bukhari 4856]
now give a thought, if these are the creations and slaves, then how great is their master and creator!
- Angels devoutly obey Allah Almighty and never disobey Him. many angels are also assigned roles/tasks, most notably delivering the revelation of Allah, blowing the trumpet for The Day of Resurrection, taking away the souls of slaves, recording people’s deeds, witnessing the circles of remembering Allah, protecting slaves when they’re awake and asleep, questioning slaves in the graves as well as guarding the Hellfire and Paradise. the number of angels are only known to Allah the mighty and sublime.
The Heavens moan, and they have the right to moan. There is no spot, the size of four fingers in them, except that there is an angel placing his forehead in it, prostrating to Allah. [Jami` at-Tirmidhi 2312]
there is no rationale or logical answer to the 'why' in your question. it is just beyond our comprehension. it is best only to believe what has come to us from quran and authentic sunnah without asking any more questions which might deviate us and create doubts within us. Allah the mighty and sublime has already given us the information we need to believe in Him and succeed in this life and the next life, insha Allah. then there are the other details, which even if we know or not will not benefit us. so it's always better to focus on what would benefit us.
On the authority of Abu Tha’labah al-Kushanee — Jurthoom bin Nashir (may Allah be pleased with him) — that the Messenger of Allah (peace and blessings of Allah be upon him) said: Verily Allah ta’ala has laid down religious obligations (fara’id), so do not neglect them; and He has set limits, so do not overstep them; and He has forbidden some things, so do not violate them; and He has remained silent about some things, out of compassion for you, not forgetfulness — so do not seek after them. [Hadith 30, 40 Hadith an-Nawawi] [A hasan hadeeth narrated by ad-Daraqutnee and others.]
may Allah the mighty and sublime grant us mercy and guide us to straight path.
Allah knows best
أَلَمْ تَرَ أَنَّ ٱللَّهَ يَسْجُدُ لَهُۥ مَن فِى ٱلسَّمَـٰوَٰتِ وَمَن فِى ٱلْأَرْضِ
Have you not seen that to Allah prostrates whoever is in the heavens and whoever is in the earth (https://quran.com/22:18)
so Angels prostrate to Allah, they worship him.
ثُمَّ قُلْنَا لِلْمَلَـٰٓئِكَةِ ٱسْجُدُوا۟ لِـَٔادَمَ فَسَجَدُوٓا۟
then We said to the angels, “Prostrate to Adam.” So they prostrated (https://quran.com/7:11)
So they do what Allah tells them to do.
They have some roles like holding the throne of Allah :
**وَٱلْمَلَكُ عَلَىٰٓ أَرْجَآئِهَا **وَيَحْمِلُ عَرْشَ رَبِّكَ فَوْقَهُمْ يَوْمَئِذٍ ثَمَـٰنِيَةٌ
And the angels will be on its borders. And on that Day, the Throne of your Lord will be carried above them by eight (angels). (https://quran.com/69:17)
Allah created the Angels to worship Him (by glorifying him and prostrating) , to do what he tells them to do (hold the throne of Allah, record the deeds of the servants of Allah, etc...) and they have some other roles that Allah put them in charge to do.