In basketball, a 'trap' is the action of the defense surrounding an offensive player with the ball. It is used to steal the ball the offense or to force a turnover. A corner trap is a trap that occurs in one of the four corners of a basketball court, or the meeting of the halfcourt line and out of bounds line.
Traps are most used near the end of a basketball game when teams are frantic to squeeze in as many possessions as possible. Teams put pressure on the team with the lead hoping for mistakes to let themselves back into the game.
If the trap happens in the backcourt, then it is before the offensive team has the opportunity to cross half court. This can be as a result of one of two reasons. The first being a bad inbounds pass. Offenses are taught to not inbound the ball into the corner for this very reason; an errant pass could lead to an opportunistic defense using a trap. The second reason is the defense may be employing a full court press. They would be hoping to deny the inbounds pass and force a 5 second violation, so the offense might have to pass it into the corner to avoid the violation.
Frontcourt corner traps are less common than backcourt ones, however, they do occur. The defensive tactic happens when the ball is with an opponent in the corner and outside the three-point line. The defense will send multiple defenders to trap the opponent in the corner, forcing them to move or shoot the ball rather than move around the court. A good defense is trained to leave that space there only to converge once the ball makes its way to the corner.
The corner is the easiest place to trap an offensive player in basketball. That is because the two sidelines that form the corner act as extra defenders. If the offensive player touches either sideline, they are out of bounds and they turn the ball over. An offensive player can be completely covered with as little as two defenders, which is important because it leaves more defenders to mark the other offensive players.