Josiah Alfred Hanan was born in Invercargill, New Zealand, on 12 May 1868, the son of James Albert Hanan, a storekeeper, and his wife, Sarah Matilda Clarke. He was educated at the Invercargill Central School (later Invercargill Middle School), becoming dux in 1883, and attended Southland Boys' High School from 1884 to 1885. Hanan practised as a barrister and solicitor in Invercargill from 1889 until 1899. He gained prominence as a civil and criminal lawyer, having worked with the noted barrister Alfred Hanlon in defending Minnie Dean and John Keown on murder charges. Pursuing an interest in public affairs which had begun while he was a law clerk, Hanan became a borough councillor in 1894. In 1897 he was elected mayor of Invercargill; Hanan was the youngest person to occupy this office and the first native-born mayor of the town.
On 2 September 1896 in Invercargill Hanan married Abigail Sarah Grehan. She died on 7 December 1898, and he married Susanna Murray, a music teacher, in Invercargill on 12 June 1902. He was elected in 1899 as Liberal MHR for Invercargill, a seat he was to hold for 26 years, and became actively involved in the civic affairs of the electorate. He was a member of the Southland Education Board from 1898 until 1901, chairman of the Southland Boys' and Girls' High Schools board of governors, and sometime president of the Southland District Law Society. Hanan's legal background became evident in his decision to lobby for the establishment of the Invercargill Borstal Institution, and in his securing the separation of the Southland Police District from Otago.
On 28 March 1912 Hanan was appointed minister of education, justice and stamp duties, holding office only until 10 July in the short-lived Mackenzie ministry. He variously held the education, justice, and immigration portfolios between August 1915 and August 1919 in the wartime National ministry formed by a coalition of the Reform and Liberal parties. Hanan was the first Invercargill politician to hold a cabinet post.
As education minister Hanan sought to introduce several major reforms. Among these were the co-ordination of the curricula of primary and secondary schools and the reshaping of post-primary schooling by placing students in courses suited to their perceived academic and practical aptitudes. He introduced a medical inspection scheme and, later, a dental service to primary schools; gave education boards the power to oversee primary, secondary, technical, and native schools; and instituted a national grading system for teachers. He also wished to raise the school leaving age; to emphasise the merits of including agricultural, domestic, manual and technical instruction in post-primary school curricula; and to introduce a national system of graded school textbooks.
Hanan's overriding aims were to enhance efficiency and to educate youths for their future citizenship responsibilities and duties. He recommended in 1912 that a commission be set up to report on matters relating to education. Some of the resulting commission's recommendations were embodied in the Education Act 1914, but much to his regret few reforms were introduced because of the outbreak of the First World War. Four years later Hanan laid before the House of Representatives a comprehensive memorandum, a blueprint for primary and post-primary school reform, which again articulated his educational philosophy. In attempting to institute 'a thoroughly reconstructive national policy', Hanan told Parliament that 'the education and training of the present and immediately following generations constitute the greatest reconstructive agencies at our disposal for the repair and reorganisation of national life'. It was an outlook that also dominated his educational thinking in post-war New Zealand.
Hanan was also interested in university education. In 1917 he was appointed to the Senate of the University of New Zealand, and 12 years later was elected its first pro-chancellor. In 1927 Hanan travelled to Canada and the United States to visit educational institutions there. As pro-chancellor and later chancellor (1935–45) he continued to emphasise the social and educational values of democratic societies while denouncing political dictatorships. Hanan's contribution to education was acknowledged by the conferring of an honorary degree of Doctor of Civil Law in 1937 by the University of Durham.
In 1923 Hanan declined an offer of the speakership of the House of Representatives. He retired from the House in 1925, possibly because he disagreed with the appointment of T. M. Wilford as leader of the Liberals. As a member of the Legislative Council from 1926 until its abolition in 1950, Hanan was assigned several committee chairmanships. He was appointed chairman of committees of the Legislative Council (1932–39); he also served on the Education Committee, and chaired the Statutes Revision Committee. As deputy speaker of the Legislative Council Hanan was invited to attend the coronation of King George VI in 1937 and the Empire Parliamentary Conference. He also represented New Zealand at the Shakespeare festival held in Stratford-on-Avon, and addressed the members of the House of Commons in London. Hanan resided in Dunedin for the last 20 years of his life, and died there on 22 March 1954, survived by his wife and two sons from his second marriage.
Josiah Hanan was regarded by fellow politicians as being liberal – almost radical – in his outlook. He described himself as a radical, strongly supported the leasehold tenure of land, and opposed party government. He earned a reputation as a strong debater who held firm beliefs which were expressed readily both within and outside Parliament. Although, as a minister, his opinions conflicted with the more conservative views of W. F. Massey, Hanan continued to argue in favour of initiating reforms and not simply preserving the status quo, notably in education. It was this willingness to embrace educational change which set Hanan apart from his ministerial predecessors, and enabled him to lay down a philosophy which has underpinned numerous debates on educational theory and practice in New Zealand schools up to the present day.