They were to keep watch for the purpose of protecting the king from harm. AT: "in order to protect King Joash" (See: [[rc://en/ta/man/translate/figs-explicit]])
These two opposite things are a merism that refers to everything the king does. AT: "You must stay near the king at all times" (See: [[rc://en/ta/man/translate/figs-merism]])