$O(n)$ is not connected, hence not path-connected, which implies it has at least two path components, or else it would be path-connected.
Now say there are at least 3 path-connected components of $O(n)$, call them $A$,$B$ and $C$.
So the image of any continuous function, say the determinant function $f$ from $A\rightarrow \mathbb{R}$ is path-connected, so range of $f$ is a singleton otherwise range contains at least $2$ points hence range of $f$ is exactly $\{-1,1\}$, as determinant of an orthogonal matrix cannot be anything else, hence it would be not path-connected(using the intermediate value property of continuous functions).
Similarly, if we take the determinant of the elements of $B$ it would either all be $1$ or $-1$ , same is the case for the set $C$.
Now by pigeon-hole principle either all elements of $A$ and $B$ have the same determinant or all elements of $A$ and $C$ have the same determinant or all elements of $B$ and $C$ have the same determinant, hence union of the two of the the $3$ sets $A$,$B$,$C$ is path-connected(By the logic of existence of continuous functions), hence a contradiction to our hypothesis that $A$,$B$,$C$ were different path components!
Hence $O(n)$ has exactly $2$ path-connected components.