There was no mention whatsoever of Joshua before the war with Amalek, but suddenly we meet him here as a thoroughly competent military leader. This is not entirely consistent with the conditions of slavery that the Jews had endured in Egypt.
The Midrash believes that Joshua (and some of Joseph’s other descendants, possibly even a substantial segment of the tribes of Ephraim and Manasseh) were not slaves in Egypt, nor did they live in Goshen, but were close to Egyptian royalty, and even owned small estates in Canaan, which at that time was a vassal state of Egypt. In particular, the Midrash says that Joshua was born in Jerusalem, and served as a mercenary in Pharaoh’s army, which is why Moses (who was also raised in the Egyptian palace) appoints him here as commander in chief.
The Torah text itself tells us nothing of this, and the question remains open whether it was really so. But we can assume that there are, in general, many details that the Torah does not mention, because its major focus is on providing information at the national level, by relating the history of the people as a whole. Given that approach, this is not the place for the Torah to elaborate on Joshua’s special status, or that of certain segments of the tribes of Ephraim and Manasseh. These are seen as only tangential details with respect to what the Torah deems truly essential for us to know.