It is the Royal Prerogative that ?the King (and Queen) can do no wrong
(for example the Queen cannot be prosecuted in her own courts)?
However, if the King or Queen did commit a crime then that would no
doubt cause a constitutional crisis and Parliament would flex its
muscles and change the constitution. But please note that there is no
single accepted definition of the prerogative, and as the British
constitution is not written in one document, and the royal prerogative
lies in ancient powers not tested in modern times, there is no
definitive answer as to what would happen.
These are the sources for this answers.
Commons Public Administration Select Committee report. 2002-3
?THE ROYAL PREROGATIVE
4. Although this is the area in which legislation has increasingly
been introduced thereby limiting the extent of the prerogative, some
significant aspects of the prerogative survive in the area of domestic
affairs. These include:
the King (and Queen) can do no wrong (for example the Queen cannot be
prosecuted in her own courts).?
You may find the wikipedia article of interest.
?The monarch is also immune from prosecution in the courts, though the
scope of the immunity that once attached to the Crown has reduced.
(The ostensible logic for this is that the Queen is present in all
courts and acts as the prosecuting authority in most criminal cases,
either directly or indirectly: she cannot therefore sue or prosecute
herself or judge her own case. However this logic can be said to be
flawed, because there appears no problem in judging her own cases as
prosecutor, or as claimant in civil litigation. The explanation most
commonly offered in texts on Crown immunity is that "the Queen can do
no wrong", and therefore cannot be held liable for breaches of
contract or in tort). In particular, several Acts of Parliament have
allowed agents of the Crown (i.e. government employees) to be sued in
the courts. The Queen's daughter, the Princess Royal actually has a
criminal record (for not keeping her dog under control).?
I hope this answers your question. If it does not, or the answer is
unclear, then please ask for clarification of this research before
rating the answer. I shall respond to the clarification request as
soon as I receive it.