Karmaliuk was enlisted to serve in the Imperial Russian Army in Kamianets-Podilskyi. He was forcibly inducted into the Russian Imperial Army, and served in the Napoleonic Wars of 1812 in an Uhlan regiment, but eventually escaped and organized rebel bands who attacked merchants and landowners, while distributing the booty between the poor. He was captured in 1814, and was sentenced in Kamianets-Podilskyi to run a gauntlet of 500 blows, a typical military punishment. He was then sent to serve out the 25-year term of penal service in a military unit in the Crimea, but he fled again, returning to northern Podolia.