Keating joined the British Army in 1793, at the outbreak of the French Revolutionary Wars. Purchasing a commission in the 33rd Regiment of Foot, Keating was almost immediately despatched to the West Indies with his regiment. Serving the campaign against French colonies in the region under Sir Charles Grey, Keating was promoted to lieutenant and fought in the invasion of Martinique, during which he was twice grievously wounded and taken prisoner by the French. While recovering from his wounds, which included a broken arm from a musket shot and a skull fracture from a shell splinter, Keating was held in a prison hulk for 18 months, before being sent to a more secure prison facility in La Rochelle. On his return to Britain in 1796, Keating was promoted to captain. In 1800 he purchased a promotion to major and was transferred to the 56th Regiment of Foot, then stationed in Ireland. Serving as a brigade major, Keating was placed in command of recruitment in County Mayo, a service for which he later received the thanks of both his senior officers and the local government. Serving through the Peace of Amiens, Keating became lieutenant colonel in command of the 56th on 1 August 1804.
Eastern service
In 1807, Keating was sent for service in British India and in 1809 was detailed to command the land forces in a combined operation against the French held islands of Île Bonaparte and Île de France. These colonies formed a base for a powerful squadron of French frigates, which were at the time causing severe damage to British trade in the region, breaking up East Indiamen convoys and seizing ships with cargoes worth over £500,000. Keating, with a detachment of soldiers provided by the Madras government and using ships from the squadron of Commodore Josias Rowley, who was in overall command, seized the small island of Rodrigues. This provided an adequate base for British ships to operate from and for amphibious operations against the other islands to be staged. Keating's first duty came in September 1809, when he was ordered to storm the port of Saint Paul on Île Bonaparte. This harbour was sheltering a French frigate named Caroline and two captured East Indiamen, but was defended by five powerful gun batteries. Keating and Rowley agreed that a frontal assault would fail, and instead devised a plan in which Keating, with 368 of his own men and 236 sailors and Royal Marines under Royal Navy CaptainNesbit Willoughby would land at Point de Galet, from Saint Paul. The force would then advance and storm the batteries from the rear. The plan was a total success, Keating's men capturing each battery in turn early in the morning of21 September and using the cannon within to fire on the shipping in the harbour. A brief attempt at defence by local forces was brushed aside, and Keating and his men re-embarked in the evening, the force remaining offshore until 28 September. Keating also masterminded the invasion and capture of Île Bonaparte and Île de France, being seriously wounded in the latter when he was stabbed in the thigh during a skirmish. For his service in the campaign, Keating was awarded 400 guineas worth of silver plate and given the governorship of the renamed Île Bonaparte, Ile Bourbon. In 1815, at the end of the war, Keating arranged for the island's return to representatives of the restored French king, Louis XVIII.