One of the early objectives in the game is to get the King safe from the opposing forces. This means he should be quickly moved from his precarious starting central position to the relative safety in one of the corners. A special castling move is designed specifically for this purpose.
So why are we talking about this now. Well the reason is it involves a Rook. First off there are a few things to clear up on this. A King can be castled to either side, short to the Kingside or long to the Queenside. The King moves two squares to his right or left and the relevant Rook is moved one square past the King toward the center.
There are a few things that need to be satisfied to make castling legal. You can only castle if the both the King and the Rook involved have not yet been moved. There must be no other piece positioned between Rook and King.
The King cannot be in check when the maneuver takes place or obviously upon it's completion. Finally no square that the King crosses when castling can be controlled by an enemy piece. In the diagram White has castled long and Black has castled short.