Castling is generally recommended as a way of protecting your king--
getting him out of the center and into a more easily defended corner.
While this is a factor, it is also useful to think of castling as a rook move, too.
Especially on the queen's side, castling brings your rook into a strong,
central attacking position.
It is also the suggestion of many beginning chess texts to castle
within the first ten moves.
Be aware, however, that castling too early gives your opponent more time
to organize an attack targeted directly at your king.
By delaying a few moves, you can keep the other player guessing at which
side your king will come to rest.
This may be just enough time for you to orchestrate a brilliant attack
of your very own.