joseph eventually wound up in egypt , where his ability to correctly interpret visions earned him a place in the pharaoh 's court , paving the way for his family 's later settlement in egypt when they got in trouble elsewhere .