Here "the sword" refers to battle. Alternate translation: "you will die in battle" or "they will kill you when you fight against them" (See: [[rc://en/ta/man/translate/figs-metonymy]])
Obeying Yahweh is spoken of as following him, and stopping doing that is spoken of as turning away from him. Alternate translation: "you stopped obeying Yahweh" or "you have decided not to obey Yahweh" (See: [[rc://en/ta/man/translate/figs-metaphor]])