do you mean if the king has been checked on a previous move? that's not what everyone else here (except Junction) seems to think you're asking.
i'll answer both questions anyways.
Castling is the only move when you can move 2 of your own pieces on the same move.
There are 2 types of castling: King's side (the rook moves 2 squares after the King moved) and Queen's side (the rook moves 3 squares after the King moved)
Yes, the king can castle if he's been in check, as long as you used the 1st or 3rd ways ©Florida Gator Man stated (the 2nd way means the king moved, see the rules below)
1. It is the King's first move
2. It is is the selected Rook's first move
3. The King is not in check
4. The square the King moves through is not a square that would be check
5. The square the King moves to is not a square that would be check (like usual)
6. There are no pieces between the King and selected Rook