In order to allow players to play the game in a fair manner, the referee can call fouls. The penalty from a foul can vary depending on the type and severity of the foul.
Minor offenses - The opposing team is awarded an indirect free kick.
More serious offenses - The opposing team is awarded a direct free kick. This will be a penalty kick if it occurs within the penalty box.
Caution - A yellow card can be given for repeated fouls. A second yellow results in a red and expulsion from the game.
Expulsion - The player must leave the game and cannot be substituted for.
Penalties for the most part are up to the discretion of the referee and what they determine to be unfair play. The referee always has the final say. Any arguing with the referee could result in a yellow or red card.
Types of Fouls
The following actions are not allowed in soccer and will result in a foul call:
Kicking an opponent
Tripping
Jumping into an opponent (like when you are going for a header)
Charging into an opponent
Pushing
Tackling from behind
Tackling an opponent and you make contact with the player prior to making contact with the ball.
Holding
Touching the ball with your hands (if you are not the goalkeeper)
The free kick is awarded from the spot of the foul, except in the case where it took place in the opponent's penalty box. In that case a penalty kick can be awarded.
Caution (Yellow Card)
The referee can choose to give a caution or yellow card to a player for the following actions:
Unsportsmanlike behavior (note that this includes trying to trick the referee)
Arguing with the referee
Fouling a lot
Delaying the game
Entering or leaving the game without informing the referee
Expulsion (Red Card)
When the referee shows a red card, this means the player has been kicked out of the game. A red card can be given for the following actions:
A serious foul
Violent actions against the referee or other players
Using their hands to stop a goal (when not the goalkeeper)
Using bad language
Receiving a second caution
The Goalkeeper
There are also special rules and fouls regarding the goalkeeper. The goalkeeper can be called for a foul for the following actions:
Holding the ball for more than 6 seconds
Touching the ball again with his hands after a teammate has kicked the ball to him
Touching the ball with his hands directly after a throw-in by a teammate