Early military career
Stewart was commissioned into the British Army in 1786 as an ensign in the 42nd (Royal Highland) Regiment of Foot. His first active service was in the Caribbean campaign of 1793–1802, where he was wounded. Stewart served in the 67th (South Hampshire) Regiment of Foot in Saint-Domingue from 1796 to 1798 before returning to Europe where he was given permission to serve with Britain's Austrian and Russian allies in Italy, Swabia and Switzerland during the Italian and Swiss expedition of 1799. Stewart was intensely interested in weapons and tactics. It was probably his observations in 1799 of Tyrolese and Croatian light infantry that did not fight in the rigid formations used by line infantry that led him to propose that the British Army should include a permanent force of light infantry equipped with rifles. His ideas won support from several prominent British officers, including the influential Colonel Coote Manningham, whom Stewart had first met in the West Indies.
In March 1800 the Experimental Corps of Riflemen was raised. On 25 August Stewart commanded the regiment at the Ferrol Expedition, where he was severely wounded in the chest leading his riflemen up the cliffs. In October the Corps was gazetted as a permanent unit, with Manningham as colonel and Stewart as its first lieutenant colonel and commanding officer. Stewart's Standing Orders for the Experimental Corps of Riflemen, demonstrated the high level of his tactical thinking compared to other British officers. He devised and implemented specially adapted forms of drill and manoeuvre, medals for bravery and good conduct, classification in shooting ability, a school and a library for the soldiers, while requiring every regimental officer to get to know each of his men as individuals.
Shortly after Stewart's 27th birthday he was appointed to command the 895 troops (114 from the Experimental Corps of Riflemen and 781 from the 49th (the Hertfordshire) Regiment of Foot) that served as supplementary marines on the British fleet sent to the Baltic in early 1801. He was stationed on the quarterdeck of Vice-Admiral of the Blue Sir Horatio Nelson's flagship HMS Elephant at the Battle of Copenhagen on 2 April 1801. Nelson reported that "The Honourable Colonel Stewart did me the favour to be aboard the Elephant; and himself, with every officer and soldier under his orders, shared with pleasure the toils and dangers of the day" (Stewart's troops lost 4 killed and 6 wounded).
Stewart was chosen for the honour of carrying to London the despatches reporting the British victory and was included by name in the Thanks of Parliament voted on 16 April 1801. Six days later he received an official letter of promotion to colonel, effective from the day of the Battle of Copenhagen. Nelson wrote to Lord St Vincent praising "Colonel Stewart, who is an excellent and indefatigable young man, and depend upon it, the rising hope of our army". Nelson wrote at least eleven letters to Stewart in the four years between Copenhagen and his death at Trafalgar, which were included in the collection of Stewart's papers privately published as "The Cumloden Papers".
The Experimental Corps of Riflemen was redesignated as the Rifle Corps in 1802 before being renamed the 95th Regiment of Foot (Rifles) in 1803 and together with the 43rd and 52nd Regiments of Foot was formed into the famous Light Brigade commanded by Sir John Moore. Stewart was the first colonel of the 95th, but soon had to hand over its operational command when he was appointed to be a brigadier general. Stewart's heart still lay with the Rifles, and in 1805 he published "Outlines of a Plan for the General Reform of the British Land Forces", which advocated general adoption of many of the innovations he had already made within the 95th.
During the Napoleonic Wars, Stewart served as a senior officer in the Alexandria expedition of 1807 and the Walcheren Expedition in 1809, before being sent to Spain in 1810. Although Stewart was only a major general, he was given the crucial task of commanding the besieged garrison of the vital Spanish port of Cádiz and initially put directly under the orders of General Arthur Wellesley, 1st Viscount Wellington. This led to an appointment to command a brigade in the 2nd Division of the British army in the Iberian Peninsula, and in December 1810 Stewart took over as commander of 2nd Division.