No, castling vertically is not allowed. You can only castle horizontally, together with king and rook.