1. He had gone to Egypt six weeks before. 'Before' means before a point in time. The Past Perfect means that point was in the past. So, these two things are OK together in the sentence.
2. He had gone to Egypt six weeks ago. 'Ago' means before now, before the present. The Past Perfect means before a point in the past.