God has told Joseph that one day he will be exalted, but in order for his exaltation (and ours) to serve the glory of God and others rather than self, he (and we) must be humbled first.

Resources:

Genesis 39-41

Word Biblical Commentary Vol. 2, Genesis 16-50, Gordon Wenham

Genesis: Tyndale Old Testament CommentariesDerek Kidner