Josiah Harmar was born November 10, 1753, in Philadelphia, Pennsylvania, the son of Rachel Harmar and an unknown father. After his mother's death on January 31, 1754, his mother's sister, Elizabeth Harmar, took in the two-month old Harmar and eventually sent him to study at Robert Proud's Quaker School. In 1775, he received a captaincy with the 1st Pennsylvania Battalion, and quickly rose up the ranks of the army, first to the position of major (1776), and then to lieutenant-colonel (1777) and adjutant general of the southern army (1782). He fought at the battles of Brandywine, Monmouth, and Stony Point, and was at Valley Forge during the winter of 1777-1778. He commanded under Washington, 1778-1780, and for the remainder of the war served as adjutant general under Nathanael Greene in the southern campaign, eventually being brevetted colonel. With the conclusion of formal peace, Congress selected him to deliver the ratified Treaty of Paris to Benjamin Franklin in Paris.
In 1784, Harmar became the lieutenant colonel commandant of the First American Regiment, and thus was the senior officer in the United States army. He spent much of his time in Ohio and western Pennsylvania with the mission to pursue Native American raiding parties, expel settlers on native lands north of the Ohio River, and take over posts evacuated by the British. On January 21, 1785, he signed the Treaty of Fort McIntosh with young members of the Delaware, Wyandot, Ottawa, and Chippewa tribes, who reportedly lacked authority to negotiate treaties. The agreement ceded lands in present-day Michigan and Ohio to the United States. In the same year, he ordered the construction of Fort Steuben, which was completed in 1786 near present-day Steubenville, Ohio.
In 1790, after rising to the rank of brevet brigadier general, Harmar undertook an expedition against the Miami and Shawnee Indians with a force of approximately 1500 militia and regular troops. Harmar and his men headed north from Fort Washington with a goal of destroying the village of Kekionga and several other Miami settlements in its vicinity, near present-day Fort Wayne, Indiana. On the way, they burned several deserted Miami villages. In mid-October 1790, they repeatedly suffered at the hands of a loose confederation of Native Americans under Chief Little Turtle, losing 40 men at the Battle of Heller's Corner or Hardin's Defeat (October 19), 20 at Hartshorn's Defeat (October 20), and suffering 129 killed in action and 94 wounded at the Battle of the Pumpkin Fields (October 21). The disaster for the American army was known as Harmar's Defeat, and although a 1791 court martial exonerated Harmar, Northwest Territory Governor Arthur St. Clair superseded Harmar as military commander. Harmar resigned from the service on January 1, 1792, and the next year was appointed adjutant general of the Pennsylvania militia, an office he held until 1799. He spent his remaining years at his estate on the western bank of the Schuylkill River, known as The Retreat, where he died on August 20, 1813.
On October 19, 1784, Harmar married Philadelphia-native Sarah ("Sally") Jenkins (1761-1847), daughter of Charles Jenkins and Mary Gray. They had four children: Charles (1785-1806), who drowned in the West Indies; Eliza (1787-1869), who married Evan W. Thomas in 1826; Josiah, Jr. (1802-1848); and William (1803-1878). Both younger sons graduated from Yale University and lived for a time in Cincinnati, Ohio, where they managed land holdings.