Bartley was born in Cloghan, County Mayo (although the 1911 census states he was born in Belfast). He was the son of RIC Sergeant John Bartley and the former Anne Costelloe, a grocer. His family later settled in Clifden, County Galway. He was educated at O'Connell Schools in Dublin and joined the Irish Volunteers in 1914. He eventually became vice-brigadier of the Connemara Brigade of the Irish Republican Army, served with a flying column during the War of Independence and was interned during the Civil War. In 1925 Bartley was elected to Galway County Council and served as chairman of the finance committee before his election to Dáil Éireann.