The Prophet (ﷺ) mentioned that the Imaam must be from Quraish, but another hadeeth mentions a caliph should be obeyed "even if he is a black Abyssinian slave". Can you reconcile between the two ahadith?
The hadeeth, “The imaams must be from the Quraish” is reported by Ahmad, while the hadeeth, “Listen and obey even if your leader is an Abyssinian slave...” is reported by Abu Dawood and at-Tirmidhee, and both of them were graded authentic by Ibn Hajar, al-Albaanee and many other Imaams of hadeeth.
The first hadeeth refers to the greater imamate, whereas the second refers to imamate in general whether it is of the greater or the lesser kind.
What the first hadeeth means is that the Imaam of the Islamic state must be chosen from the Quraish (as long as he meets the other requirements of moral integrity and so on). However, the second hadeeth tells us that if there is no choice in the matter and a non-Quraishee, such as an Abyssinian slave, comes into power by force or some other means, obedience to him becomes compulsory in all good things and revolting against him becomes forbidden – unless he displays clear-cut disbelief.
In other words, the first hadeeth talks about the situation where the khaleefah is chosen, while the second one refers to when a person comes into power by some other means.
This seems to be a better explanation, and Allaah knows best, although Imaam al-Khattaabee did give the interpretation you mentioned – that obedience to an Abyssinian slave means obedience to any person who the Imaam appoints as a leader over the people, not that the Imaam himself can be an Abyssinian slave.
In any case, the Prophet’s (ﷺ) command to obey the leader even if he is an Abyssinian slave does not necessarily imply his approval of choosing a non-Quraish Imaam. Rather, it either represents an example of a supposition made as a basis for reasoning or conveying knowledge of the unseen concerning what will happen in the future.
 Sunan Abi Dawood, Book 1, Hadith 44
 The above explanations are summarized and adapted from Daleel-ul-Faaliheen (2/202-203) by Ibn ‘Allaan; Tuhfat-ul-Ahwadhee(#2676) by al-Mubaarakfooree; Liqaa’-ul-Baab-il-Maftooh (#185) of Ibn Uthaymeen and a verdict by Abd-ul-Kareem al-Khudayr.< Back to Questions