The accepted answer is completely correct as to what action the referee should take against the goalkeeper.
Furthermore, if there is now a hole in the field which is large enough to make it difficult to take a penalty kick, in addition to cautioning the goalkeeper, the referee should suspend the game and not allow the penalty kick until ground staff or someone from the home team repairs the hole (depending on the level of competition). This is not only a fairness concern for the team taking the penalty kick, but also a safety concern for players from both teams.
The referee's power to suspend matches due to player infringements and for other interference is granted on p. 25 of the 2015/16 FIFA Laws of the Game:
- stops, suspends or abandons the match, at his discretion, for any infringements of the Laws
- stops, suspends or abandons the match because of outside
interference of any kind
The power of the referee to make decisions with respect to the condition of the field of play is within the match official indemnity waiver (and strangely not within the law regarding the field of play) on p. 27:
A referee (or where applicable, an assistant referee or fourth official) is not held liable for:
any kind of injury suffered by a player, official or spectator
any damage to property of any kind
any other loss suffered by any individual, club, company, association or other body, which is due or which may be due to any decision that he may take under the terms of the Laws of the Game or in respect of the normal procedures required to hold, play and control a match.
Such decisions may include:
- a decision that the condition of the field of play or its surrounds or that the weather conditions are such as to allow or not to allow a match to take place