He joined the Royal Navy in the 1770s and served off the Eastern Seaboard of North America during the American War of Independence, seeing action at the Siege of Charleston. He was subsequently transferred to Newfoundland and, as a lieutenant, given command of the sloop HMS "Morning Star" for the remainder of the war. During the peace of 1783 to 1793, Donnelly joined the fleet of the Honourable East India Company, serving as a mate before rejoining the Navy at the outbreak of the French Revolutionary Wars.