Law 3 – The Number of Players
Changing the Goalkeeper
  Any of the other players may change places with the goalkeeper, provided that:
  • the referee is informed before the change is made;

  • the change is made during a stoppage in the match.

Infringements/Sanctions
  If a substitute enters the field of play without the referee’s permission:
  • play is stopped;

  • the substitute is cautioned, shown the yellow card and required to
    leave the field of play;

  • play is restarted with an indirect free kick at the place the ball was
    located when play was stopped * (see page 3)
If a player changes places with the goalkeeper without the referee’s permission before the change is made:
  • play continues;
more on The Number of Players