Born the son of John Dalrymple, 2nd Viscount Stair and Elizabeth Dalrymple, Dalrymple accidentally killed his brother in a shooting accident in April 1682 and thereafter spent most of his early life in the Netherlands where he studied at Leiden University. He joined up as a volunteer for the Nine Years' War with the Earl of Angus's Regiment and fought at the Battle of Steenkerque in August 1692. At Steenkerque he rallied his regiment several times when the ranks had been broken by cannon fire. In 1695 he became Master of Stair when his father succeeded to the Viscountcy of Stair. He was commissioned as a lieutenant colonel in the 3rd Foot Guards on 12 May 1702 and fought with the Duke of Marlborough during the War of the Spanish Succession at the Battle of Peer in August 1702 and the Battle of Venlo in September 1702. At Venlo he also saved the life of the Prince of Hesse-Kassel. He became Viscount Dalrymple in 1703 when his father was created 1st Earl of Stair. In January 1706 he was appointed colonel of the Earl of Angus's Regiment. He commanded a brigade at the Battle of Ramillies in May 1706 and, having been promoted to brigadier general on 1 June 1706, became colonel of the Grey Dragoons on 24 August 1706. He became 2nd Earl of Stair in January 1707 when his father died and later that year he was elected as one of sixteen Scottish representative peers in the newly formed Parliament of Great Britain. He commanded a brigade at the Battle of Oudenarde in July 1708, the Siege of Lille in Autumn 1708 and then, having been promoted to major general on 1 January 1709, at the Battle of Malplaquet in September 1709. In Winter 1709 the Duke of Marlborough sent him on a diplomatic mission to Augustus II of Poland. He returned in time to take part in the Siege of Douai in April 1710. Promoted to lieutenant general on 1 June 1710, he fought at the Siege of Bouchain in August 1711. He was also appointed a Knight of the Thistle that year. He was sent to Flanders to join the military campaign there in April 1712 and became colonel of the Black Dragoons on 9 April 1714.
Diplomatic service
When King George I ascended to the throne in August 1714, Dalrymple was sent as an envoy to the Court of France at Versailles. He was temporarily recalled on 20 November 1714 to take up the appointment of Commander-in-Chief of the Forces in Scotland. According to the Duc de Saint-Simon, Stair quickly established friendly relations with Philippe II, Duke of Orléans, Regent to the young King Louis XV, paving the way for the Triple Alliance. During his time in Paris, Stair's spies effectively thwarted various "intrigues" by the Jacobites. Stair retired from his position as ambassador in Paris in June 1720. In 1729, he became Vice Admiral of Scotland, but lost the position on 5 May 1733, mainly because of his opposition to the Excise Bill of 1733 promoted by Prime Minister Robert Walpole. He was promoted to full general, on the basis of seniority, on 27 October 1735 and also found time to lay out the gardens at Castle Kennedy in the 1730s.
War of the Austrian Succession
On 20 March 1742, after Walpole had fallen from office, Dalrymple was promoted to field marshal. On 17 April 1742 he was made Governor of Minorca and on 20 April 1742 took command of the "Pragmatic Army" sent to act with Hanoverian and Austrian forces in support of the Pragmatic Sanction to appoint Maria Theresa to the position of Empress of Austria. He was appointed Commander-in-Chief of the Forces in South Britain on 28 February 1743 and colonel of the Black Dragoons again on 30 April 1743 and led the allies to victory at the Battle of Dettingen in June 1743. He retired from command of the army in Flanders at his own request on account of his advancing years in September 1743 and retired as Commander-in-Chief of the Forces to make way for General Wade in 1745. On 4 June 1745 he became colonel of the Grey Dragoons and on 14 June 1746 he became General of the Marine Forces. His favourite residence was Newliston near Kirkliston in Linlithgowshire, where he laid out gardens in the French style. He died on 9 May 1747 at Queensberry House in Edinburgh and was buried in the family vault at Kirkliston.
Family
In March 1708 he married Lady Eleanor Primrose Campbell, daughter of James Campbell, 2nd Earl of Loudoun. They had no children. Sir Walter Scott's story My Aunt Margaret's Mirror is believed to have been based on efforts made by the Earl of Stair to get Lady Eleanor Primrose Campbell to marry him. Stair wanted his earldom to pass to his nephew John Dalrymple; but on 4 May 1748 the House of Lords ruled that the right to nominate an heir had lapsed, and the earldom passed to the legal heir James Dalrymple, 3rd Earl of Stair.