\[ \boxed { {\frac {{\rm d}^{2}}{{\rm d}{x}^{2}}}y \left ( x \right ) =-{\frac { \left ( 2\,f \left ( x \right ) \left ( {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) ^{2}g \left ( x \right ) - \left ( \left ( g \left ( x \right ) \right ) ^{2}-1 \right ) \left ( f \left ( x \right ) {\frac {{\rm d}^{2}}{{\rm d}{x}^{2}}}g \left ( x \right ) +2\, \left ( {\frac {\rm d}{{\rm d}x}}f \left ( x \right ) \right ) {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) \right ) {\frac {\rm d}{{\rm d}x}}y \left ( x \right ) }{f \left ( x \right ) \left ( {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) \left ( \left ( g \left ( x \right ) \right ) ^{2}-1 \right ) }}-{\frac { \left ( \left ( \left ( g \left ( x \right ) \right ) ^{2}-1 \right ) \left ( \left ( {\frac {\rm d}{{\rm d}x}}f \left ( x \right ) \right ) \left ( f \left ( x \right ) {\frac {{\rm d}^{2}}{{\rm d}{x}^{2}}}g \left ( x \right ) +2\, \left ( {\frac {\rm d}{{\rm d}x}}f \left ( x \right ) \right ) {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) -f \left ( x \right ) \left ( {\frac {{\rm d}^{2}}{{\rm d}{x}^{2}}}f \left ( x \right ) \right ) {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) - \left ( 2\, \left ( {\frac {\rm d}{{\rm d}x}}f \left ( x \right ) \right ) g \left ( x \right ) +v \left ( v+1 \right ) f \left ( x \right ) {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) f \left ( x \right ) \left ( {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) ^{2} \right ) y \left ( x \right ) }{ \left ( f \left ( x \right ) \right ) ^{2} \left ( {\frac {\rm d}{{\rm d}x}}g \left ( x \right ) \right ) \left ( \left ( g \left ( x \right ) \right ) ^{2}-1 \right ) }}=0} \]
Mathematica: cpu = 1.326669 (sec), leaf count = 169 \[ \text {DSolve}\left [y''(x)=-\frac {y'(x) \left (2 f(x) g(x) g'(x)^2-\left (g(x)^2-1\right ) \left (2 f'(x) g'(x)+f(x) g''(x)\right )\right )}{f(x) \left (g(x)^2-1\right ) g'(x)}-\frac {y(x) \left (\left (g(x)^2-1\right ) \left (f'(x) \left (2 f'(x) g'(x)+f(x) g''(x)\right )-f(x) f''(x) g'(x)\right )-f(x) g'(x)^2 \left (2 g(x) f'(x)+v (v+1) f(x) g'(x)\right )\right )}{f(x)^2 \left (g(x)^2-1\right ) g'(x)},y(x),x\right ] \]
Maple: cpu = 0.203 (sec), leaf count = 21 \[ \left \{ y \left ( x \right ) ={\it \_C1}\,{\it LegendreP} \left ( v,g \left ( x \right ) \right ) f \left ( x \right ) +{\it \_C2}\,{\it LegendreQ} \left ( v,g \left ( x \right ) \right ) f \left ( x \right ) \right \} \]