My answer as posted on Quora here: http://qr.ae/DyzTt
Castling is the only time in chess when a player is allowed to move two of his/her own pieces simultaneously. The rearrangement that occurs when a player castles is beneficial because the king usually finds increased safety away from the dangerous center files while the rook boosts its attacking potential by moving out of the corner. Some common reasons to avoid castling include:
1) If castling will expose your king to greater danger.
2) If your opponent’s most threatening pieces (especially the queen) have already left the board.
3) If your rook is supporting an important advance of a flank pawn.
4) If you have powerful tactics available immediately and castling will cost you the initiative.