I read that $O(M)$ is connected if and only if $M$ is not orientable. Is it true? If there is an answer, I would very much like to see a proof. Thank you.
If you assume that $M$ itself is connected, then it is true.
First, if $M$ is orientable and connected, then $O(M)$ has (at least) two connected components, one for each orientation of frame, either agreeing with a specified orientation or not.
If $M$ is not orientable, then, using the Levi-Civita connection for the Riemannian metric and parallel translating a frame around a non-orientable loop in the manifold will show that any two frames at a point can be connected, since the orthogonal group in any dimension has exactly two components. Then any two fibers of $O(M)\to M$ can be connected since $M$ is connected, so it follows that $O(M)$ itself is connected.