Joshua Gregory entered the army in 1805 as an ensign in the 78th Highlanders (Ross-shire Buffs). At the age of 16 he saw active service when his regiment was sent to Sicily at the height of the Napoleonic Wars. He was part of the successful campaign at Calabria, followed by an unsuccessful campaign in Egypt, where Gregory was severely wounded. In April 1807 he was sent back to England to recover, then rejoined his battalion for the successful invasion of Java. In Java, Gregory, by then a lieutenant, began suffering from ill health. He was posted to Fort George in Scotland, but his health continued to deteriorate, and in 1818 he was forced to retire on half-pay.
On 14 June 1812, while stationed at Fort George, Joshua Gregory marrived Francis Churchman. By 1825 they had five surviving children, and Gregory had difficulty supporting his family on his pension. In 1829, the Gregory family emigrated to Western Australia, arriving on the Lotus four months after the establishment of the Swan River Colony. Gregory was initially granted land on the left bank of the Swan River, but the soil was poor, and he later obtained other grants at Maylands and in the Upper Swan district. He was later appointed a Justice of the Peace. On 20 August 1838, he died after a long illness.