It's to make it easier for the referee to correctly judge the hand-ball rule. If the goalie jumps for the ball in a crowd and one of the other players illegally touches the ball with his arm, it's easy for the referee to see that a foul has been committed - because the goalie's arms are a different color to the other players.
If the goalie gets injured and there are no more substitutes so that he has to be replaced by an outfield player, that player has to put on a goalkeeper's jersey.