A prisoner exchange or prisoner swap is a deal between opposing sides in a conflict to release prisoners: prisoners of war, spies, hostages, etc. Sometimes, dead bodies are involved in an exchange.
Under the Geneva Conventions, prisoners who cannot contribute to the war effort because of illness or disability are entitled to be repatriated to their home country. That is regardless of number of prisoners so affected; the detaining power cannot refuse a genuine request.
Under the Geneva Convention (1929), this is covered by Articles 68 to 74, and the annex. One of the largest exchange programmes was run by the International Red Cross during World War II under these terms. Under the Third Geneva Convention of 1949, that is covered by Articles 109 to 117.
The Second World War in Yugoslavia saw a brutal struggle between the armed forces of the Third Reich and the communist-led Partisans. Despite that, the two sides negotiated prisoner exchanges virtually from the beginning of the war. Under extraordinary circumstances, these early contacts evolved into a formal exchange agreement, centered on the creation of a neutral zone, possibly the only such in occupied Europe, where prisoners were regularly swapped until late April 1945, saving several thousand lives.