Convert quaternion from right-handed to left-handed coordinate system
This is a condensed version of an answer to a slightly different question.
The problem you ask about arises even if the two coordinate systems are same-handed; it turns out that handedness flips don't make the problem significantly harder. Here is how to do it in general. To change the basis of a quaternion, say from ROS (right-handed, Z up) to Unity (left-handed, Y up):
mat3x3 ros_to_unity = /* construct this by hand by mapping input axes to output axes */;
mat3x3 unity_to_ros = ros_to_unity.inverse();
quat q_ros = ...;
mat3x3 m_unity = ros_to_unity * mat3x3(q_ros) * unity_to_ros;
quat q_unity = mat_to_quat(m_unity);
Lines 1-4 are simply the method of https://stackoverflow.com/a/39519079/194921: "How do you perform a change-of-basis on a matrix?"
Line 5 is interesting; not all matrices convert to quats, but if ros_to_unity is correct, then this conversion will succeed.
Note that this will give you a correct result, but it goes through a lot of work -- conversion to and from a matrix, some multiplies, an inversion. But you can examine its results and then write a special-case version that rearranges or flips axes, like the one aka.nice derived.
A rotation of angle x around axis (u,v,w) can be represented by quaternion with real part cos(x/2) and unreal part sin(x/2)*(u,v,w).
If axis coordinates are (u,v,w) in original trihedron, they will be (u,w,v) in your trihedron.
Thus if original quaternion was (a,b,c,d) - a+ib+jc+kd - the quaternion must be transformed to (a,b,d,c) in your trihedron.
EDIT
But because your trihedron is left handed, the angle also has to be reversed, so the same rotation can finally be expressed by the quaternion (a,-b,-d,-c) in your trihedron.