If Iblees was not one of the angels, why was he commanded to prostrate to Adam along with the angels?
Undoubtedly, when Allah, may He be exalted, commanded the angels to prostrate to Adam, this command was also addressed to Iblees, as Allah, may He be exalted, says (interpretation of the meaning):
“…except Iblees (Satan), he refused to be of those who prostrate.
(Allah) said: ‘What prevented you (O Iblees) that you did not prostrate, when I commanded you?’”
[al-A‘raaf 7:11, 12].
The scholars have spoken about the reason why the command to prostrate to Adam was addressed to Iblees even though he was not one of the angels; they stated that the reason for that was that he was similar to the angels in their outward deeds.
Ibn Katheer (may Allah have mercy on him) said (1/105):
The conclusion is that when Allah, may He be exalted, commanded the angels to prostrate to Adam, He included Iblees in that because, even though he was not one of them, he was imitating them and doing deeds like their. Hence he was included in what was addressed to them, and he was condemned for going against the command. End quote.
Shaykh Ibn ‘Uthaymeen said in Tafseer Soorat al-Baqarah (1/127):
If someone were to say: there is something confusing in this verse, which is that when Allah, may He be exalted, says that He commanded the angels to prostrate, He says that they all prostrated except Iblees, and it would appear to mean that Iblees was one of them, but that is not the case;
The answer to that is that Iblees shared with them their outward deeds, so the command included him on the basis of his outward deeds. End quote.
Something similar was also said by al-‘Allaamah at-Taahir ibn ‘Ashoor in his tafseer, at-Tahreer wa’t-Tanweer (1/409). What we are obliged to believe is that the command to prostrate to Adam was addressed to Iblees just as it was addressed to the angels, and this is what the Qur’an clearly says:
“(Allah) said: ‘What prevented you (O Iblees) that you did not prostrate, when I commanded you?’”
As for the reason why this command was addressed to him, Allah knows best.
And Allah knows best.