[proofplan]
The proof is a direct functoriality argument in cohomology. A compatible reduction supplies a classifying map $g:M\to BH$ and a homotopy between $f$ and $i\circ g$. Homotopy invariance identifies the two pullbacks $f^*$ and $(i\circ g)^*$, and functoriality rewrites $(i\circ g)^*$ as $g^*\circ i^*$. The obstruction statement is then the contraposition of this necessary condition.
[/proofplan]
[step:Use the compatible reduction to identify the classifying maps up to homotopy]
By hypothesis, the reduction of structure group to $H$ is classified by the map
\begin{align*}
g:M\to BH,
\end{align*}
and compatibility with the original principal $G$-bundle means precisely that the extension of this $H$-bundle along $H\hookrightarrow G$ is classified by the composite
\begin{align*}
i\circ g:M\to BG.
\end{align*}
Since $P$ is classified by
\begin{align*}
f:M\to BG,
\end{align*}
the chosen classifying data give a homotopy
\begin{align*}
f\simeq i\circ g.
\end{align*}
[/step]
[step:Apply homotopy invariance and functoriality to the universal class]
Let $u\in H^*(BG;R)$ be a homogeneous cohomology class. Singular cohomology with coefficients in $R$ is homotopy invariant, so the homotopy $f\simeq i\circ g$ implies
\begin{align*}
f^*u=(i\circ g)^*u.
\end{align*}
Cohomology pullback is contravariantly functorial for continuous maps, and the maps involved have composable domains and codomains:
\begin{align*}
M\xrightarrow{g}BH\xrightarrow{i}BG.
\end{align*}
Therefore
\begin{align*}
(i\circ g)^*=g^*\circ i^*.
\end{align*}
Evaluating this identity on $u$ gives
\begin{align*}
(i\circ g)^*u=g^*(i^*u).
\end{align*}
Combining the two equalities yields
\begin{align*}
f^*u=g^*(i^*u).
\end{align*}
[guided]
We fix a homogeneous universal class $u\in H^*(BG;R)$. The characteristic class of the principal $G$-bundle $P$ determined by $u$ is, by definition of universal characteristic classes, the pullback $f^*u\in H^*(M;R)$.
The compatible reduction supplies the map $g:M\to BH$, and the induced map of classifying spaces is
\begin{align*}
i:BH\to BG.
\end{align*}
Thus the classifying map obtained after extending the reduced $H$-bundle back to a $G$-bundle is the composite
\begin{align*}
i\circ g:M\to BG.
\end{align*}
The compatibility assumption states that this composite classifies the same $G$-bundle as $f$, with the chosen classifying data giving a homotopy
\begin{align*}
f\simeq i\circ g.
\end{align*}
We now use the standard homotopy invariance of singular cohomology pullback: homotopic maps induce the same map on cohomology. Applying this to the homotopic maps $f$ and $i\circ g$ gives
\begin{align*}
f^*u=(i\circ g)^*u.
\end{align*}
The next point is purely functorial. Cohomology is contravariant, so the pullback along a composite is the composite of pullbacks in the reverse order. Since
\begin{align*}
M\xrightarrow{g}BH\xrightarrow{i}BG
\end{align*}
is a composable pair of maps, functoriality gives
\begin{align*}
(i\circ g)^*=g^*\circ i^*.
\end{align*}
Evaluating this identity on the class $u\in H^*(BG;R)$ gives
\begin{align*}
(i\circ g)^*u=g^*(i^*u).
\end{align*}
Combining this with the homotopy-invariance equality gives
\begin{align*}
f^*u=g^*(i^*u).
\end{align*}
This is exactly the asserted factorisation of the characteristic class through $BH$.
[/guided]
[/step]
[step:Conclude the obstruction statement by contraposition]
The preceding step proves that every compatible reduction of $P$ to $H$ forces the identity
\begin{align*}
f^*u=g^*(i^*u)
\end{align*}
for every $u\in H^*(BG;R)$. Therefore, if there exists a class $u\in H^*(BG;R)$ for which no compatible classifying map $g:M\to BH$ can satisfy this identity, then the necessary condition for a compatible reduction fails. Hence $P$ admits no reduction of structure group to $H$ compatible with the chosen classifying data.
[/step]