"Carry out" here is an idiom meaning to do something that was commanded or planned. This can be stated in active form. Alternate translation: "when the people were about to obey the king's law and decree" (See: [[rc://en/ta/man/jit/figs-idiom]] and [[rc://en/ta/man/jit/figs-activepassive]])
"the situation was reversed." The situation being reversed is a metaphor meaning that the opposite of what was expected happened. Alternate translation: "the opposite happened" (See: [[rc://en/ta/man/jit/figs-metaphor]])