\[ 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)} \] ✓ Mathematica : cpu = 0.10141 (sec), leaf count = 24
DSolve[Derivative[2][y][x] == -((Derivative[1][y][x]*(2*f[x]*g[x]*Derivative[1][g][x]^2 - (-1 + g[x]^2)*(2*Derivative[1][f][x]*Derivative[1][g][x] + f[x]*Derivative[2][g][x])))/(f[x]*(-1 + g[x]^2)*Derivative[1][g][x])) - (y[x]*(-(f[x]*Derivative[1][g][x]^2*(2*g[x]*Derivative[1][f][x] + v*(1 + v)*f[x]*Derivative[1][g][x])) + (-1 + g[x]^2)*(-(f[x]*Derivative[1][g][x]*Derivative[2][f][x]) + Derivative[1][f][x]*(2*Derivative[1][f][x]*Derivative[1][g][x] + f[x]*Derivative[2][g][x]))))/(f[x]^2*(-1 + g[x]^2)*Derivative[1][g][x]),y[x],x]
\[\{\{y(x)\to c_1 f(x) \operatorname {LegendreP}(v,g(x))+c_2 f(x) \operatorname {LegendreQ}(v,g(x))\}\}\] ✓ Maple : cpu = 0.289 (sec), leaf count = 20
dsolve(diff(diff(y(x),x),x) = -(2*f(x)*diff(g(x),x)^2*g(x)-(g(x)^2-1)*(f(x)*diff(diff(g(x),x),x)+2*diff(f(x),x)*diff(g(x),x)))/f(x)/diff(g(x),x)/(g(x)^2-1)*diff(y(x),x)-((g(x)^2-1)*(diff(f(x),x)*(f(x)*diff(diff(g(x),x),x)+2*diff(f(x),x)*diff(g(x),x))-f(x)*diff(diff(f(x),x),x)*diff(g(x),x))-(2*diff(f(x),x)*g(x)+v*(v+1)*f(x)*diff(g(x),x))*f(x)*diff(g(x),x)^2)/f(x)^2/diff(g(x),x)/(g(x)^2-1)*y(x),y(x))
\[y \left (x \right ) = f \left (x \right ) \left (\operatorname {LegendreP}\left (v , g \left (x \right )\right ) c_{1}+\operatorname {LegendreQ}\left (v , g \left (x \right )\right ) c_{2}\right )\]