It is basically just a shortcut that cuts the game short by one move once the outcome is obvious. According to Wikipedia, "In early Sanskrit chess (c. 500–700) the king could be captured and this ended the game. The Persians (c. 700–800) introduced the idea of warning that the king was under attack (announcing check in modern terminology). This was done to avoid the early and accidental end of a game. Later the Persians added the additional rule that a king could not be moved into check or left in check. As a result, the king could not be captured."
The one difference from "real chess" that it does cause is actually rather significant. In a normal game of chess, stalemate (for this example, White Ke6, Pe7; Black Ke8; black to move) is declared a draw, as Black has no legal move. If moving into check were allowed and capturing the king ended the game, Black could move his king in this situation and White would capture it, winning the game. Opinions vary, even among grandmasters, whether stalemate is a good rule for chess or not, but in any case it is a consequence of the check rules, and a large fraction of draws are the result of it. Once again Wikipedia has a good summary of the consequences for endgame theory of abolishing the stalemate rule and making capturing the king the requirement to win the game.