For the most part of his life Osip Kozlovsky was attached to the Russian Imperial Court, for which he wrote most of his music. In Russia he became popular especially for his patriotic polonaises.
Born in Warsaw, he was a choir boy at St. John Cathedral. From 1775 he worked in Trakai at the palace of Tadeusz Franciszek Ogiński as a teacher of Michał Kleofas Ogiński (1765–1833) the statesman, rebel, and composer, known for his polonaise Pożegnanie Ojczyzny / Razvitannie z Radzimaj (Farewell to the Homeland).
He moved to Russia in 1786, where he became involved in the war against Turkey. He entered the army as aide-de-camp to Prince Dolgoruky. Soon he became known to Prince Grigory Potemkin, the prime minister (and accredited lover of Catherine II) between 1774 to 1776. Impressed by the musical talent of Kozlovski, Potemkin introduced him to the Court.
In 1791 he wrote the music for the unofficial Russian national anthem of the late 18th and early 19th centuries Grom pobedy, razdavaysya! (Russian: Гром побе́ды, раздава́йся!; English translation: Let the thunder of victory sound), text by Gavrila Derzhavin. The second part of this polonaise was later quoted by Peter Tchaikovsky in the final scene of his opera The Queen of Spades.
When the private theatre of Count Nikolai Sheremetev was transferred from Kuskovo to Ostankino, Kozlovsky’s opera (lyrical drama) Russian: Зельмира и Смелон, или Взятие Измаила — (English translation: Zelmira and Smelon, or the Capture of Izmail) to a text by Pavel Potemkin, was premiered on July 22, 1795. The famous serf soprano Praskovya Zhemchugova acted the role of the captive Turkish woman Zelmira. The opera was revived and performed again on August 28, 2004 at the same place in Ostankino.
Between 1799 and 1819 Kozlovsky supervised the theatre orchestras and the theatrical college at St Petersburg. Kozlovsky composed a famous Requiem Mass in E flat minor Missa pro defunctis for the death of Stanisław August Poniatowski, the King of Poland (1732–1798), commissioned by the King himself before his death and performed on February 25, 1798 in St Petersburg. He wrote another requiem for the death of the Emperor Alexander I. His considerable production included stage music for Edip in Afinakh (Oedipus in Athens, 1804), Fingal (tragedy by V. Ozerov, 1805), Tsar Edip (Oedipus Rex) (1816), Esphir (by Racine 1816), litugical music including the Te Deum, cantatas, choruses, songs (including 28 Russian songs), about 70 polonaises and other dance music for the Court balls, etc.
Tchaikovsky quotes a polonaise by Kozlovsky in the ballroom scene of Pique Dame.