Pinning it's a tactical procedure common to many games. You can use it in any phase of the game; in fact many openings use this tactic to disturb the opponent's piece development. Pinning involves the participation of three pieces: a piece is attacking another one which is being protected by a third one placed between the two.
In the following position we have more than one of these tactical procedures.
The white pawn at b4 is pinned by the black rook at a4. Now you can understand why it's called pinning: the pawn is unable to move because then the white rook would be captured with 1. Ra4:c4. The white pawn at f3 is also pinned because it's placed between the king at e2 and the black queen at h5 (the pawn can't be moved because then the king would enter under the range of action of the queen). Some of Black's pieces are also pinned. If it were Black's turn to move then he wouldn't be able to capture the rook at f6 with the knight from d5 because the knight is pinned by the queen from d1. As a side remark: capturing the pawn at b4 with the rook 1...Ra4: b4 is wrong because after Rc4:b4 Black is unable to capture the white rook with the knight from d5 . The black rook at e5 is pinned by the bishop from g3.
You can see, of course, that if a piece is pinned to the king, it is unable to move; if it's pinned to another piece it can move.
The following moves are common to the queen's Gambit 1. d4 d5 2.c4 e6 3. Nc3 Nf6 and with 4. Bg5 White pins the black knight to the queen; the resulted position is shown in the next example.
In the example below after 1... Rg8:g4 White is unable to capture the rook because the pawn at f3 is pinned by the bishop from b7.
In the next example White pinned, with his queen, the black knight at g5 which was protected by his queen. But with 1...Nf3+ Black checks the white king and after g:f3 Black captures the unprotected white queen : Q:d2 .
In the next position White moved the queen at g3 and pinned the pawn from g7. Black didn't give much attention to this and took no actions. That allowed the following move: 1.Bc1:h6. Black can't capture the bishop with his pawn because that would place his king in check from the white queen. Now White won a pawn and not only that: he now threatens checkmate with the queen at g7. This type of pinning (the pinning of the pawn in front of the castled king) is quite frequent so pay attention to it in your games.
Here is another example of pinning the pawn in front of the castled king: