Penal military unit
In the modern day, the practice of fielding penal military units has largely stopped, with most militaries discouraging or outright prohibiting the acceptance of convicts, though some militaries accept ex-convicts provided they fulfill certain requirements, such as having a proper waiver. For example, a U.S. military recruiter told The Daily Beast in 2018 that recruitment candidates can have "one non-violent felony as an adult", and that "some of the best and most capable candidates we get require a waiver". However, though rare, the practice of accepting convicts into armed forces has continued or been made permissible in some jurisdictions and situations. During the Russian invasion of Ukraine, for instance, the Armed Forces of Ukraine permitted the recruitment of Ukrainian prisoners with prior combat experience, and Russian private military company Wagner Group began hiring Russian inmates to fill their ranks.

By country: 

Belgium: Special Forestry Platoon – A Belgian Army non-combat penal platoon composed of Flemish soldiers who had some relationship with the Flemish Movement during World War I. Formed in 1918, the unit conducted woodchopping in Orne, Normandy, France as a form of penal labour until several months after the end of the war.

Bolivia: 50th Infantry Regiment – A Bolivian Army penal regiment composed of convicted soldiers and police officers that served in the Chaco War.

Finland: Erillinen Pataljoona 21 ("Separate Battalion 21") – A Finnish Army penal battalion founded in August 1941, from volunteering prisoners and leftists in protective custody, that fought in the Continuation War. Commanded by Major Nikke Pärmi, the distinguishing mark of Er.P 21 was the black V sewn into the sleeve of their uniform; these gave them the nicknames of "Pärmi's Devils" and "Black Arrow".

France: Régiment pénal de l'Île de Ré ("French Penal Regiment of Île de Ré") – One of five regional penal units forming part of the French Army in the early 1810s. Formed in 1811, the unit was stationed on Île de Ré, and was disbanded in 1814 during the First Restoration.
Battalions of Light Infantry of Africa (Bataillons d'Infanterie Légère d'Afrique) – Penal battalions serving in French North Africa, composed of men with prison records who still had to complete their military service, and serving soldiers with serious disciplinary problems. Formed in 1832, this corps was disbanded in 1972.
Bataillon d'Infanterie légère d'Outre-Mer ("Overseas Light Infantry Battalion") – A penal battalion consisting of German prisoners of war and French collaborationists after World War II. Formed in 1948 for service in the French colonies, the unit attracted few members and was subject to a campaign by the French Communist Party before it was disbanded in 1949.
Disciplinary Company of the Foreign Regiments in the Far East (Compagnie disciplinaire en Extrême-Orient) – A penal company of the French Foreign Legion in the Far East, consisting of Legionnaires who had committed serious offenses. Formed in 1946 and attached to the 2nd Foreign Infantry Regiment, the company depended on the battalions implanted in French Indochina. After French Indochina's dissolution following the 1954 Geneva Conference, the company was disbanded in August 1954.

Germany: Strafbataillon ("Penal Battalion") – A generic term for penal units in the Wehrmacht, fielded between 1942 and 1945. These units were poorly armed and often undertook what were essentially suicide missions.
999th Light Afrika Division – A Wehrmacht penal division stationed in Tunisia, originating from the 999th Africa Brigade in 1942. The unit consisted of individuals who held, or were perceived to hold, anti-fascist beliefs. The unit suffered heavy casualties in the North African campaign, and members were reportedly so unwilling to fight for Germany that they quickly surrendered their positions to Allied troops when confronted. After the unit transferred to Axis-occupied Greece, several members defected or began conducting anti-Nazi activities. The unit was disbanded in 1943.
Dirlewanger Brigade – A Waffen-SS penal brigade consisting of convicted criminals who were not expected to survive their service. Formed in 1940 for counterinsurgency operations, it became notorious even among the Waffen-SS for the sheer depravity of its war crimes, being responsible for several mass murders in Eastern Europe.

Italy: Cacciatori Franchi ("Frankish Hunters") – The penal unit of the Royal Sardinian Army. Established around 1741, the unit existed until 1878, when disciplinary companies were established.
Battaglione di Rigore ("Penalty Battalion") – The penal unit of the Italian Social Republic military.
Battaglioni degli Imprigionati ("Battalions of the Imprisoned") – Penal battalions of the Redshirts in the Wars of Italian Unification, composed of prisoners and revolutionaries.

Paraguay: Macheteros de Jara - An auxiliary cavalry regiment that was created on 15 August 1932. Members of the regiment consisted of former outlaws.

Russia: Storm-Z – a group of penal military units established in April 2023, during the Russian invasion of Ukraine
Storm-V – a group of penal military units established in June 2023, during the Russian invasion of Ukraine

South Korea: Unit 684 – A black operations unit of the Republic of Korea Air Force, consisting largely of petty criminals. Formed in 1968 in response to the Blue House raid, wherein Unit 124 of the Korean People's Army Special Operation Force attempted to assassinate South Korean President Park Chung Hee, Unit 684 received extremely harsh training on the island of Silmido in anticipation for a retaliatory operation to assassinate North Korean General Secretary Kim Il Sung. However, warming relations by 1971 led to the mission's cancellation and the unit's dissolution; the members of Unit 684 promptly launched a violent escape attempt, culminating in a standoff that led to the deaths of most of the unit and the capture and execution of the remaining survivors.

Soviet Union: Shtrafbat – Penal battalions of the Red Army and NKVD, composed of sentenced soldiers, political prisoners, and others deemed to be expendable, fighting on the Eastern Front of World War II. Established in 1942 by Joseph Stalin in Order No. 227, over 422,000 prisoners were placed into shtrafbats until their disestablishment following victory in Europe in May 1945, by which point very few had survived.

Ukraine: Kharakternyky Battalion – Nicknamed "The Magicians" and "Characterniks" the battalion was formed after the Verkhovna Rada passed Registered draft law No. 11079 which allowed for the mobilization of convicts into the Ukrainian Army.
Shkval Battalion - Also known as the Wind Gust Battalion. It was formed after the Verkhovna Rada passed Registered draft law No. 11079 which allowed for the mobilization of convicts into the Ukrainian Army.

United States: Galvanized Yankees – A term used to refer to Confederate States Army and Confederate States Navy former personnel and prisoners of war who, after their capture, swore allegiance to the Union and enlisted in the Union Army and Union Navy during the American Civil War. The practice of enlisting Confederate prisoners to Union forces began around 1862 and lasted until 1866. A similar practice was conducted by the Confederate States of America, but not to the same extent.

In popular culture: The Dirty Dozen – A 1967 film about the titular fictional American penal unit, composed of military prisoners trained as commandos for a suicide mission ahead of the Normandy landings during World War II. The film was a commercial and critical success, and was followed by several television film sequels in the 1980s: The Dirty Dozen: Next Mission, The Dirty Dozen: The Deadly Mission, and The Dirty Dozen: The Fatal Mission.
Silmido – A 2003 film dramatizing the story of Unit 684. The film is credited with having increased public awareness of Unit 684's story, though some aspects of the film are fictionalized due to numerous details of the actual story remaining classified.
Ace Combat 7: Skies Unknown – A 2019 combat flight simulation video game, part of which follows "Spare Squadron", a penal squadron of the fictional Osean Federation's air force that is considered disposable and used to test enemy combat drone defenses, overseen by a prison warden serving as their commander and airborne early warning and control operator.
Suicide Squad – A fantastical version of the concept within the DC Comics universe.

References: 

External links: Yefim Golbraikh memoirs, including his serving commander of a penal company (in Russian)
Soviet penal units in World War 2, from Voice of Russia
Report: Saudis sent death-row inmates to fight Syria, 21 January 2013