The British Law has a clause which stipulates that civil and criminal proceedings cannot be taken against the sovereign of the United Kingdom.
Laws are passed by Parliament then go to the King/Queen for approval.
If the King/Queen decides not to give royal assent then the law won’t pass.
Queen Elizabeth actually did that in 1999. Parliament wanted to pass a bill taking her power authorize military strikes. She didn’t like the idea and shut it down completely.
Kings/Queen almost never use this power these days but it is something they can do at any time.
This means the King/Queen can do almost anything without fear or arrest.
The King/Queen can take over any ship in British waters at anytime.
A famous case of this happened in 1982 when the cruise ship “Queen Elizabeth 2” was taken over by the British Government. They used it to invade the Falklands.