Hartmann was born on 11 December 1902 in Silstedt near Wernigerode in the Province of Saxony, a province of the Kingdom of Prussia in the German Empire. He was the third child of Albert Hartmann, an evangelic pastor in Wernigerode, and Helene Hartmann, née Wernicke. Hartmann had one older brother, Rudolf, and an older sister, Edith. From 1909 to 1914, he attended the "Volksschule", a primary school, in Silstedt and later the "Gymnasium", a secondary school, in the district of Magdeburg.