Warberg was born on 2 December 1845 in Värmdö Municipality, Sweden. He was commissioned as an officer in 1864 in 2nd Life Guards ("Andra livgardet") with the rank of "underlöjtnant". Warberg attended the Royal Swedish Army Staff College in 1867 and was promoted to lieutenant the year after. In 1871 he was appointed general staff officer and was in 1874 appointed staff adjutant and lieutenant in the General Staff as well as to captain there in 1875. In 1877 he served a military attaché for six months in the Russian Army of the Danube during the Russo-Turkish War. Warberg was then stationed partly at the headquarters and partly in the 9th Army Corps. He attended the shelling and the battle of Nikopol fortress and the fortress's surrender in July. Furthermore, he was an attentive witness to the various afflictions at Plevna, Sgalevica and Pelisat as well as to the Siege of Plevna. Back in Sweden, Warberg served as chief of staff of the Life Guards Brigade ("Livgardesbrigaden") from 1878 to 1881 and at the 4th Military District ("4:e militärdistriktet") from 1881 to 1885.