Suppose $f$ has two consecutive roots $a$ and $b$, and for a contradiction, suppose $g$ has no roots on $[a,b]$. Divide both sides of the inequality by $f(x)$ and $g(x)$ to get
$$F(x) := \frac{f'(x)}{f(x)} \neq \frac{g'(x)}{g(x)} =: G(x). \qquad x \in (a,b)$$
Then $F(x)$ is continuous on $(a, b)$ and
$$\lim_{x \to a^+} F(x) = +\infty \\ \lim_{x \to b^-} F(x) = -\infty$$
Since $G$ does not diverge near $a$ or $b$, this implies that
$$\lim_{x \to a^+} [F(x) - G(x)] = +\infty \\ \lim_{x \to b^-} [F(x) - G(x)] = -\infty$$
So the function $F - G$ is continuous on $(a,b)$, and goes from $+\infty$ to $-\infty$. By the mean value theorem, $F - G$ has a root on $(a,b)$, say $c$. But this implies that $F(c) = G(c)$, which contradicts our inequality. So $g$ must have a root on $[a,b]$.