The National Anthem of the Republic of Poland, also called "Jeszcze Polska nie zginela" ("Poland has not yet perished", from the first line of the lyrics) or "Piesn Legionów Polskich we Wloszech" ( "Song of the Polish Legions in Italy"), was written in July 1797 in Reggio near Bolonia by Jozef Wybicki, one of the organisers of general Jan Henryk Dabrowski's Polish Army in Italy.
The author of the melody is less clear; it is usually ascribed to Michal Kleofas Oginski, but this has not been determined with certainty. It is most likely based on an anonymous fok song, due to the unusual mazurka tempo (which is often played at a faster rate than most anthems.)
The opening line "Jeszcze Polska nie zginela" refers to the partitions of Poland between Russia, Prussia and Austria in 1795. The chorus "March, Dabrowski, from Italy to Poland" refers to the Polish legions, who were all wiped out in the Caribbean while members of Napoleon's troops.
Its familiar mazurka melody and its message - a call to join the fight for independence - inspired numerous 19th century patriotic songs and national hymns of the Slavonic nations under foreign rule (some of which would later become Yugoslavia, which could explain the similar melody of the former Yugoslav anthem.) The opening line of the lyrics were also borrowed by Ukraine (which, of course, speaks of the Ukraine not perishing rather than Poland.) In the early years after Poland's revival in 1918, during the debate about the choice of the national anthem, several candidates were considered. On February 28th 1927 the choice of "Dabrowski's Mazurek" as the national anthem was officially announced.
Above is a souvenir sheet of the anthem lyricist Wybicki issued in 1997