DSolve[Derivative[2][y][x] == -(Csc[x]^2*(-((-1 + a)*a) - (-(1 + a)^2 + a^2*b^2)*Sin[x]^2 - a*(1 + a)*b*Sin[2*x])*y[x]),y[x],x]