A medieval Polish settlement existed at the site as early as the 12th century. The oldest known mention of Koźmin comes from 1232, it was a village owned by the Knights Templar. It was granted town rights between 1251 and 1283. In 1338, King Casimir III the Great gave the town to Maćko Borowiec, who built a castle there. The castle, located along present-day Zamkowa Street, is still in use today; it houses a school and the Muzeum Ziemi Koźminskiej. Koźmin was a private town located in the Kalisz Voivodeship in the Greater Poland Province of the Polish Crown. The town changed owners several times; it was the property of the Górkas, a prominent Greater Poland family, in the 16th century, and later belonged to the Sapieha family. It was considered one of the most powerful towns in Greater Poland in the 15th and 16th century. Koźmin prospered through trade and crafts. In the 17th century it was a local Reformation center. After the Second Partition of Poland, in 1793, it was annexed by Prussia. Regained by Poles in 1807, it was included in the short-lived Polish Duchy of Warsaw, in 1815 it was re-annexed by Prussia. The Poles took part both in the unsuccessful Greater Poland uprising of 1848 and the victorious Greater Poland uprising of 1918–1919, after which Kobylin was integrated with Poland, shortly after it regained independence. During World War II, Koźmin Wielkopolski was under German occupation from 6 September 1939 to 23 January 1945. One of the best-preserved Jewish cemeteries in Greater Poland is located in Koźmin Wielkopolski, along Wierzbowa Street. It includes more than 250 graves, dating back as far as 1806. The cemetery is maintained by a local teacher, Jerzy Fornalik, who is also the author of a multicultural education program, "Anty-Schematy," for students from Poland, Israel, Germany, and other countries. A former women's prison from World War II, which housed female political prisoners under the Nazi occupation, is located along present-day Klasztorna Street. Currently a youth education center is located in the building. Some of the prisoners are buried in a mass grave, commemorated by a monument, in the cemetery along Poznańska Street.