Originally trained as a teacher, McWilliams became a journalist in 1877, rising to editor of the Launceston Telegraph in 1883. Marrying Josephine Fullerton in Melbourne on 19 October 1893, McWilliams’s role as editor helped his stature in the local community enough to ensure his election to the Tasmanian House of Assembly for the electorate of Ringarooma in the 1893 election. In parliament, McWilliams advocated strongly on behalf of farmers, investigated the possibility of introducing sugarbeet farming into Tasmania and helped found the Tasmanian meteorological bureau.
He also supported giving women and ex-convicts the vote but opposed Federation, believing it should be delayed.
An Australian Rules football fan, in 1897 McWilliams founded the Southern Tasmania Football Association and remained a senior figure in Australian Rules football administration in Tasmania. McWilliams bought the Hobart-based Tasmanian News in 1896 and moved to Hobart shortly after, unsuccessfully standing for the seat of Glenorchy in 1900.
In parliament, McWilliams, like almost all his fellow members, strongly supported the White Australia Policy, but opposed federal spending on issues such as the establishment of the High Court of Australia, a federal department of agriculture, a transcontinental railway and federal acquisition of the Northern Territory. As in state parliament, McWilliams was a staunch advocate on rural matters, supporting the timber industry and primary producers.
After assisting in the formation of the Country Party in 1920, McWilliams was appointed as its first federal parliamentary leader.
However McWilliams did not always see eye to eye with his party colleagues and at times voted against the wishes of the party. He was relieved of the leadership of the Country Party in April 1921 and lost his seat at the 1922 election. McWilliams left the Country Party soon after and unsuccessfully contested Franklin at the 1925 election as a Nationalist.
Switching to federal politics, McWilliams won the Franklin at the 1903 election as a Revenue Tariffist supporting the Free Trade Party on most economic issues.