From the Air Navigation Order:
Flight crew licence requirement – Exception for members of HM Forces
58 A person may act as a member of the flight crew of an aircraft registered in the United
Kingdom without being the holder of an appropriate licence if, in so doing, the person
is acting in the course of his or her duty as a member of any of Her Majesty's naval,
military or air forces.