Consider the transitive action of $O(2,1)$ on $N_{-1}= \{(x,y,z) \in \mathbb{R}^3 \mid x^2+y^2-z^2=-1 \}$ by left multiplication. For some $x \in N_{-1}$, you get a continuous surjection $$\left\{ \begin{array}{ccc} O(2,1) & \to & N_{-1} \\ M & \mapsto & M \cdot x \end{array} \right. .$$
So you have $SO(2,1) \hookrightarrow O(2,1) \twoheadrightarrow N_{-1}$. But $N_{-1}$ is a two-sheeted hyperboloid, and the image of $SO(2,1)$ in $N_{-1}$ is not contained in one sheet of $N_{-1}$ since $\left( \begin{matrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & -1 \end{matrix} \right) \left( \begin{matrix} 0 \\ 0 \\ 1 \end{matrix}\right) = \left( \begin{matrix} 0 \\ 0 \\ -1 \end{matrix}\right)$.

Because a continuous image of a connected set is connected, $SO(2,1)$ has at least two connected components.
In fact, it can be shown that the connected component of $SO(p,q)$ containing $\operatorname{Id}$ is $$SO_0(p,q)= \left\{ \left( \begin{matrix} A & B \\ C & D \end{matrix} \right) \in SO(p,q) \mid A \in GL_p(\mathbb{R}), \ \det(A) >0 \right\}.$$
Therefore, $SO(p,q)$ is connected iff $p=0$ or $q=0$.