On this side of the water, the Armed Forces owe their allegiance to the Crown, not Parliament:
"I swear by Almighty God [or: do solemnly, and truly declare and affirm] that I will be faithful and bear true allegiance to His Majesty King Charles III, His Heirs and Successors, and that I will, as in duty bound, honestly and faithfully defend His Majesty, His Heirs and Successors, in Person, Crown and Dignity against all enemies, and will observe and obey all orders of His Majesty, His Heirs and Successors, and of the [admirals/generals/air officers] and officers set over me."
Now Parliament, as the designated representative of the people, is given authority by the Crown to enact the will of the people, of whom the Crown is the servant and protector. Therefore, most of the time, the forces comply with the instructions of Parliament. But should the Chiefs of Staff feel that what they are being asked/ordered to do is either illegal, against Kings' Regulations, or in violation of their Oaths of Allegiance, they have the right to refuse those orders. In theory, the Monarch could countermand orders from Parliament and issue their own. If Parliament decided to use the Army against any part of the British public, I can't personally see King Charles sitting still for it!