Islam and Christianity agree that Aaron was second in command to Prophet Moses (peace be upon them) during his life. Since Aaron passed away before Prophet Moses, Joshua was appointed to be next in line as the successor. This view is shared by bakrite scholars.
The Bible shares this narrative and describes an event where Moses asks God for a successor so that "the LORD’s community may not be like sheep that have no shepherd", to which God commands Prophet Moses to 'lay' his hand upon Joshua and appoint him as successor 'before the whole community'. This event interestingly shares a striking similarity with the event of Ghadir Khumm.
Source: ShiaBrain