If you work with coefficients in a field $\mathbb{F}$, assume that $H^*(BH;\mathbb{F})$ is a free $H^*(BG;\mathbb{F})$-module, and add the assumption that the Serre spectral sequence has a *product structure* (i.e. the map
$$H^p(BG;\mathbb{F}) \otimes H^0(BG ; H^q(G/H;\mathbb{F})) \overset{\smile}\longrightarrow H^p(BG ; H^q(G/H; \mathbb{F})) = E_2^{p,q}$$
is an isomorphism) then the Serre spectral sequence collapses. This can be proved by considering the lowest row a potential differential could start on. (Unfortunately I don't know a reference.)  This shows that
$$H^*(BH;\mathbb{F}) \cong H^*(BG;\mathbb{F}) \otimes H^0(BG ; H^*(G/H;\mathbb{F}))$$
as $H^*(BG;\mathbb{F})$-modules. To get the conclusion you want you must further suppose that $\pi_0(G)$ acts trivially on $H^*(G/H;\mathbb{F})$, but in this case the product structure is automatic.