Born in Plymouth, Devon, Lockyer was son of Thomas Lockyer, a sailmaker, and his wife Ann, née Grose. Lockyer began his army career as an ensign in the 19th Regiment in June 1803, was promoted lieutenant in early 1805 and made captain in August 1805. Lockyer was promoted to major in August 1819 and in August 1824 transferred to the 57th Regiment. Lockyer arrived at Sydney, capital of the British Colony of New South Wales, aboard the Royal Charlotte in April 1825 with men from the 57th; also with him were his wife and ten children.
In August 1825, Lockyer was asked to lead an expedition to explore the upper reaches of the Brisbane River, which had only recently been settled by Europeans. On 2 September, Lockyer sailed from Sydney in the cutter Mermaid, arriving at the settlement of Brisbane on 7 September. Leaving the Mermaid at Brisbane, he travelled in a small boat up the river. Lockyer saw coal in deposits on the banks, becoming the first person to identify coal in Queensland. Lockyer arrived back in Sydney on 16 October 1825, and made a report to Governor Sir Thomas Brisbane.
In late 1826, Lockyer led an expedition to claim Western Australia for Britain. He sailed on the brig Amity, arriving at King George Sound on 25 December, with twenty troops and twenty three convicts. This was the beginning of the first European settlement in Western Australia. On 21 January 1827, as instructed by the Secretary of State for War and the Colonies Earl Bathurst, the Union Jack was raised and a feu de joie fired by the troops, formally annexing the territory, in assertion of the first official claim by the Imperial Government to British possession over the whole continent of Australia.
The military base established by Lockyer was named Frederick Town, later renamed Albany, and would become an important deep water port. His interview with two sealers, arrested for crimes against local people, revealed intelligence of Dumont D'Urville's survey of King George Sound. Lockyer had planned an overland journey to the Swan River region in February, but learned that James Stirling had already examined the area. Lockyer was to remain in the settlement until command could be given to Captain Joseph Wakefield. Lockyer returned to Sydney on 3 April 1827, sold his army commission and settled in Sydney.
In 1852 Lockyer was appointed serjeant-at-arms to the New South Wales Legislative Council and on 16 May 1856 he became the Council's first Usher of the Black Rod. In September 1854 he was commissioned a captain on the formation of the Sydney Volunteer Rifle Corps, a citizens' militia force.
On 18 November 1854, Lockyer married Elizabeth Colston. Elizabeth Colston is related to Mal Colston, a Queensland Senator.
The Sydney suburb of Ermington is named after Lockyer's residence, "Ermington House". A suburb of Albany, Western Australia, commemorates the city's founder. Lockyer Creek, Lockyer Valley and Lockyer Valley Regional Council in Queensland were named after Major Lockyer. His name and image were utilized in the Centenary of Albany, Western Australia and the booklet published at that time.