Provided that $n,p>0$, $O(n,p)$ has four connected components as well. There are many ways to see this. $O(n,p)$ is a matrix subgroup of the general linear group of $\mathbb{R}^{n+p}$:
$$ O(n,p) = \lbrace a \in \operatorname{GL}(n+p,\mathbb{R}) \mid a^T \eta a = \eta\rbrace$$
where
$$\eta = \begin{pmatrix} -I_n & 0 \cr 0 & I_p \end{pmatrix}$$
with $I_k$ the $k\times k$ identity matrix.
It follows from the defining equation $a^T \eta a = \eta$ by taking determinants that $\det a = \pm 1$. We let $SO(n,p)$ denote the normal subgroup consisting of $a \in O(n,p)$ with $\det a = 1$. Then if $a_- \in O(n,p)$ is any matrix with $\det a_- = -1$, then
$$O(n,p) = SO(n,p) \sqcup SO(n,p)\cdot a_-$$
where the union is disjoint. This shows that $O(n,p)$ is diffeomorphic to the disjoint union of two copies of $SO(n,p)$ and it remains to study the connectedness properties of $SO(n,p)$.
$SO(n,p)$ is homotopy equivalent to its maximal compact subgroup, which by polar decomposition is
$$S(O(n)\times O\(p\)) = \lbrace (a_1,a_2) \in O(n)\times O\(p\) \mid \det a_1 \det a_2 = 1 \rbrace$$
This can be shown to have two connected components, by a very similar argument to the one at the start of this answer. Each such component is diffeomorphic to $SO(n) \times SO\(p\)$. Now use that $SO(m)$ is connected to conclude that $SO(n) \times SO\(p\)$ is as well.
This gives you the four connected components of $O(n,p)$.
Basic facts like this about classical Lie groups can be found in Wulf Rossmann's book "Lie groups, an introduction through linear groups."