A foul in basketball is a rule-breaking action that can be either physical, like grabbing and pushing, those are called personal fouls; or technical, like screaming at the referee or at an opponent, which are called technical fouls . All fouls lead to a penalty. In the NBA, if a player commits six fouls in a game he is disqualified from that game; the same is true for FIBA and college basketball, but the foul limit is of five fouls.
IMPORTANT: The foul types and rules of fouls differ at all levels of play in high school basketball, the NBA, college basketball, and FIBA.
A personal foul is any rule breaking physical action by a player. Any illegal contact like pushing, grabbing, hitting, and tripping are personal fouls. Personal fouls are committed by either offense or defense, although there are more defensive fouls in a game than offensive fouls. Fouls are part of the game of basketball, and committing and suffering fouls is all part of the game.
Defensive fouls are committed whenever players on defense use of illegal contact to try to stop attacking players. Defensive fouls happen all the time in basketball. Defenders are allowed to move sideways and backwards to block an attacker's path, moving forward (pushing the attacker backwards), is not allowed. Players also can't initiate contact on defense as that is a foul, that happens mostly when a player unsuccessfully tries to steal the ball or block a shot. Defensive fouls have different penalties depending on what point of a play they were committed.
Whenever a defender commits a foul on the opponent while he or she is shooting, the player who suffered to foul gets to shoot free throws, those are called shooting fouls. If the shooter was attempting a three-point ball, he or she gets three free throws, while if it is a two-point attempt, only two shots. Sometimes a player suffering a foul gets to shoot free throws, regardless of being a shooting foul or not. That happens when the fouling team has committed five or more fouls in the quarter and finds itself in a penalty situation.
When a player is fouled not during his shooting action, and the opponent team is not in a penalty situation, the other team gets possession of the ball at the nearest sideline spot. They must put the ball back into play with an inbound pass.
Offensive fouls in basketball are the illegal contacts committed by offensive players. Offensively, players sometimes foul when trying to get past defense by pushing or holding opponents. The most common offensive fouls are charging fouls, and illegal screens. Every offensive foul leads to change of possession, unless the team who committed a foul is in a penalty situation.
Technical fouls are those that although do not involve any illegal physical contact, do break a rule in basketball's rulebook. That includes calling for a timeout when the team has called all of them, screaming at a player or referee, and fighting. The penalty for a technical is, the opposing team is awarded a free throw plus possession of the ball.
You can learn more about fouls by reading the following tutorials.