It's my understanding that at least by the beginning of the 20th century and probably earlier than that, the Prime Minister has been the de facto Commander-in-Chief of the British Armed Forces and, as such, has the power to unilaterally commit them to armed conflict (of course, such an act would not be taken without consultation with the other ministers of the ruling government).
The process by which the power of the government shifted from the hands of the Monarch to those of his or her 'Prime' Minister occurred over a period of centuries. The legislative body, Parliament, has its origins in the Middle Ages and it was during the Early-Modern Period that opposing factions within the members of the House of Commons coalesced into distinct political parties (the most important were nicknamed the Whigs and the Tories).
It was during the late-17th and early-18th centuries that Britain's Monarchs found that, to better ensure the passage of bills they wanted to become law, it made sense to rely on the political party that had the most members elected to Parliament - that held the majority in Parliament. It would be from this, the majority party, that the Monarch would pick his ministers to run the various departments of the government.
In turn, Monarchs found that it was more practical to appoint a Minister to oversee the coordination of the Monarch's other Ministers than to have to manage this themselves. This, of course, was the birth of the Monarch's 'Prime' Minister.
It was also during the late-17th and early-18th century that power increasingly shifted from the hands of the Monarch to the hands of the Prime Minister. In 1688, the leaders of both of the major political parties in Parliament decided to invite William of Orange and his wife, Mary, to replace the reigning Monarch, James II - an event known as the 'Glorious Revolution'. The coup was successful, as both the British Army and the British Navy stationed in England abandoned James II, who was forced to flee to France. But the leaders in Parliament were not about to acknowledge William as their new King without first extracting from him a written agreement that laid out the powers of Parliament versus those retained by the Monarch, which included control over both the Army and the Navy.
When Queen Anne died in 1714, she left no direct heirs to the throne, so that the next closest relative had to fill the vacancy. This just so happened to be the reigning king of a small German state, Hanover. King George I did not speak English and, in any case, did not much care for the business of governing. As such, King George I began a tradition of leaving the actual day-to-day running of the government in the hands of the Prime Minister.
The Monarchy still wielded a degree of control over Parliament through both the act of signing bills sent to him or her by Parliament, thus officially transforming these bills into law, and, indirectly, by the appointment of members of the peerage to the House of Lords. The ability of the House of Lords to vote down bills sent to it by the House of Commons, however, was fatally undermined in 1912 with the passage of a law that stated that any bill that had been passed in the House of Commons three times had to be automatically passed by the House of Lords to be sent on to the Monarch to be signed into law.
The role of the Monarch in signing bills, thus officially transforming them into law, has largely become a formality (I confess, I don't know when last time was that a reigning British Monarch refused to sign a bill sent to them by Parliament).