Petrović was born in Siokovac in the Levač region, and moved to Ostružnica by the Sava. Many Serbs fled across the Danube and Sava into the Military Frontier of the Habsburg Monarchy after increased Ottoman oppression. Petrović and his family moved to Syrmia, and he entered Habsburg service, becoming a border guard. With the outbreak of the Austro-Turkish War (1787–91), he joined the Serbian Free Corps, a Serb volunteer unit fighting the Ottomans in central Serbia, consequently occupied by the Habsburgs (1788–92). For his operation, managing to open the Belgrade Fortress Gates, he was awarded the rank of captain. For his service during the war, he was awarded knighthood by Leopold II in 1792. He also served as a volunteer fighting the French. He used his military experience to train Serb rebels in the First Serbian Uprising (1804–13). The leader of the uprising, Karađorđe, who had fought in Petrović's volunteer unit, viewed him as his foster father.