Cohomology class of the group extension from a principal bundle Let $M$ be a closed connected manifold and fix a basepoint $q \in M$ and a Riemannian metric on $M$. Let $F(M)$ denote the orthonormal frame bundle of $M$. This is a principal $O(n)$-bundle over $M$ ($n = \dim M$). The homotopy sequence of this bundle reads
$$\dots \to \pi_2(M,q) \to \pi_1(O(n),I) \to \pi_1(F(M),F_0) \to \pi_1(M,q) \to \pi_0(O(n),I)\to\dots$$
where $F_0$ is a fixed frame over $q$. Let $\pi_1^{\text{or}}(M,q)$ be the kernel of the penultimate arrow; this is the subgroup of $\pi_1M$  represented by "orientable" loops. Then we have the group extension
$$0 \to A \to \pi_1(F(M),F_0) \to \pi_1^{\text{or}}(M,q) \to 1$$
where $A$ is the quotient of $\pi_1(O(n),I)$ by the image of $\pi_2(M,q)$. Assume $A \simeq \mathbb Z_2$ (which happens for $n \geq 3$ and $w_2(M) = 0$, I think). Then this is a central group extension and therefore we have the associated class in the second group cohomology $H^2(\pi_1^{\text{or}}(M,q);\mathbb Z_2)$. What can be said about this class in terms of the topology of $M$? Does it have to do anything with Stiefel-Whitney classes? When is it trivial?
It seems that when $M$ is orientable and Spin, then this class is indeed trivial; moreover different splittings of this extension correspond to different Spin structures.
A reformulation of this is as follows (I'm adding this just to give an additional perspective): the above fiber bundle gives rise to the associated based loop space fibration
$$\Omega SO(n) \to \Omega F(M) \to \Omega^{\text{or}}M$$
and the group extension is obtained by looking at the last terms of the corresponding homotopy sequence.
And lastly, it looks like this should be understood in the broader context of principal bundles and characteristic classes. If someone can point me in the direction of understanding this or give a reference, that'd be great.
 A: Let $M$ be an orientable manifold, with chosen base point $q$ and chosen Riemannian metric. The extension of the question arises from the principal bundle $SO(n)\to F(M)\to M$. 
There is another bundle giving rise to the same extension, namely $\mathbb{RP}^\infty\to \tilde{M}\to M$, and there are three equivalent ways of constructing it. On the one hand, it can be obtained from stabilization to $SO(\infty)$ plus change of fibre along the action $SO(\infty)\times\mathbb{RP}^\infty\to\mathbb{RP}^\infty$. On the other hand, it can be obtained by passing to the stable tangent bundle and then taking the associated $\mathbb{RP}^\infty$-bundle. Third, the $\mathbb{RP}^\infty$-bundle is the pullback of the universal $\mathbb{RP}^\infty$-bundle $\mathbb{RP}^\infty\to\{\operatorname{pt}\}\to K(\mathbb{Z}/2,2)$ along the classifying map $M\to BSO(n)\to K(\mathbb{Z}/2,2)$. Under the identification $[M,K(\mathbb{Z}/2,2)]\cong H^2(M,\mathbb{Z}/2)$, this is the Stiefel-Whitney class $w_2$. (Note that the classifying map of the frame bundle can be identified with the classifying map for the tangent bundle, the frame bundle arises from choice of structure group reduction from $GL_n(\mathbb{R})$ to $SO(n)$ applied to the tangent bundle. This choice of reduction of structure group is the same as a choice of a Riemannian metric.)
[Edit:] To see that the $\mathbb{RP}^\infty$-bundle yields the same extension on fundamental groups, the first construction (via change-of-fiber) is the most helpful. The change of fiber induces a map $F(M)\to \tilde{M}$, such that the map induced on homotopy fibers is $SO(n)\to SO(\infty)\to \mathbb{RP}^\infty$. Therefore, we get a commutative ladder of the long exact homotopy sequences associated to $SO(n)\to F(M)\to M$ and $\mathbb{RP}^\infty\to\tilde{M}\to M$. The change-of-fiber has the effect of killing all homotopy groups of $SO(n)$ in degrees $\geq 2$, but induces an isomorphism on $\pi_1$; therefore, the part of the exact sequence relevant for the extension question is therefore unchanged when changing the fiber from $SO(n)$ to $\mathbb{RP}^\infty$. 
I think, obstruction theory shows that a splitting of the extension is the same as a section of the bundle $\mathbb{RP}^\infty\to \tilde{M}\to M$, because $\mathbb{RP}^\infty\cong K(\mathbb{Z}/2,1)$. This way, one could see that the extension splits if and only if $w_2=0$.
In the general case where $M$ is not necessarily orientable, then $\pi_1^{\operatorname{or}}(M)$ is the fundamental group of the orientation cover, the pullback of $BSO(n)\to BO(n)$ along the classifying map $M\to BO(n)$. I think the above arguments can be applied to the orientation cover and then characterize the splitting of the extension as triviality of $w_2$ for the orientation cover.
