I'm reading the Sharpes series and they have talked about how in the British army an officer would normally buy a commission so to become a high ranking officer it was more a question of wealth rather than skill.
When did they change this system to the more meritocratic system we are used to today?
Purchase of commissions was abolished in 1871 by William Gladstone's Liberal government under the Cardwell Reforms, largely as a response to the debacles of the Crimean War (in particular the Charge of the Light Brigade). Prior to that, the assumption was that a "gentleman" of proper education and birth would be fit to lead troops without much additional training: though the Royal Military Colleges at Sandhurst and Woolwich already existed, attendance at Sandhurst was optional and Woolwich was more of a technical college for the Artillery and Engineers. This expectation was not entirely unfounded: perhaps because of it, most gentlemen officers demonstrated extraordinary bravery on the battlefield. It is easily forgotten that the Earl of Cardigan actually led the Charge of the Light Brigade from the front and never looked back, reaching the Russian guns and surviving the fight. However, what Cardigan did next was emblematic of many of the problems the British Army experienced with its officer corps: after the charge, he went back to his yacht moored in Balaclava harbour and enjoyed a champagne dinner. For all their bravery and however well-intentioned they may be, the man-management skills of British officers were appalling, and many spent the winter in the fleet offshore while their men froze on the Crimean Peninsula. Purchase died a death soon afterwards and was replaced by compulsory attendance at Sandhurst with a rigorous entrance exam.
Rather amusingly, Gladstone's abolition of purchase was not, as commonly thought, to open the officer corps to young men of the middle classes. It was because the younger sons of wealthy middle class families that had come up from trade and industry were now able to afford commissions and were pricing out the gentry. The abolition of purchase gave men from "traditional" military backgrounds the chance to compete with the newcomers.
Sources:
Richard Holmes, Redcoat: The British Soldier in the Age of Horse and Musket
Royal Military Academy Sandhurst, The Queen's Commission: A Junior Officer's Guide