Berg along with his siblings spent their childhood in the Sagnitz castle and were home educated by the young Friedrich Georg Wilhelm Struve. He was brought up as a Lutheran. After he finished his home education he studied in the in Dorpat. Originally not seeking a military career as a family tradition, Berg enrolled into the Philosophy faculty of Imperial University of Dorpat in 1810. But after Napoleon invaded of Russia in 1812, Berg dropped out from university and voluntarily entered the Russian Imperial Army. He entered the army as a Fahnenjunker and was enlisted into the 6th Libau Infantry Regiment which was stationed at the north-western part of Russia to defend against Napoleon. Berg's bravery during the war of 1812 rewarded him the rank of lieutenant from Alexander I personally. He was also appointed second to the quartermaster due to his high education and being multilingual among Russian soldiers at the time.