As Islam stands against waging war, especially against the innocents, it never overlooks the possibility that mankind may resort to war against each other. That’s why it shows keenness on regulating warfare; it enumerates those that should not be killed or even targeted during the battles. Not only that, but Islam also sets rules regarding those taken as prisoners of war; how they should be treated and dealt with.
Islam does not allow any form of abuse, whether physical or sexual, against the POWs. On the contrary, the Islamic texts have preceded the Geneva Convention in demanding clemency with captives and stressing that prisoners of war must be dealt with in an extremely merciful and kind manner.

Following is what the late Sheikh Muhammad Abu Zahrah, wrote abut this topic in his book Concept of War in Islam:

Islam advocates clemency with captives. History has never known warriors so merciful to their captives as the early Muslims who followed the teachings of their religion. Numerous religious texts demand clemency with captives.
Prisoners are usually taken when a battle is at its height and there is danger that rage may lead the victorious warriors to harm those who have been defeated in order to take revenge. The Prophet, however, urged his followers to treat their captives with clemency. He said to them “You have to treat your captives kindly.” He also urged his Companions on the day of Badr to be kind to their captives. Accordingly, the Companions of the Prophet (peace and blessings be upon him) gave their captive preference over themselves in matters of food. This is the tolerance of Islam and its respect for the human dignity.

In this way Muslims learned two kinds of Jihad. The first is Jihad in the battlefield where people give themselves to the cause of Allah and the second one is Jihad against one’s desires that restrains man’s rage and allows him to fight his foes with clemency and not in accordance with the laws of the jungle.
What are the teachings of Islam as regards the prisoners of war? Does Islam grant them freedom, ransom or enslave them to the Muslims? Here, we should again refer to the religious texts and the example given by the Prophet (peace and blessings be upon him). The most direct of these texts is Allah’s saying: [So when you meet in battle those who disbelieve, then smite the necks until when you have overcome them, then make (them) prisoners, and afterwards either set them free as a favor or let them ransom (themselves) until the war terminates] (Muhammad 47: 4).

The Qur’anic verse thus provides alternatives: either the Muslim commander should free those captives who cannot offer ransom either in the form of money or an equivalent number of Muslim captives, or he should ransom his captives for money or for a similar number of Muslim captives. This is what is now known as an exchange of prisoners.
the religion of freedom, therefore, esteems the freedom of those who do not follow it as much as it does that regarding its followers, for if the advocate of freedom is himself free, he will not make any discrimination on regional, racial or religious grounds, because freedom is a natural right to every human being.

The Qur’anic verse does not mention a third choice, namely the enslavement of captives; the Qur’anic text explicitly forbids it by limiting the choice to only two alternatives – free dismissal or ransoming – without referring to enslavement. Thus enslavement is not involved in the choice.
Moving to the Prophetic sunnah, we shall again find that the Prophet never enslaved a free man throughout his reign. His Companions did take some captives among the spoils in the conquest of “Bani al-Mustaliq” and turned them into salves. The Prophet (peace and blessings be upon him) did not explicitly prohibit them from doing that, but his own action (of setting free a prisoner) prompted them to release their captives.

This implies prohibitions of enslavement although it is not explicit. The Prophet avoided the enslavement of any free man in his wars; his actions tended towards its denunciation. He urged the manumission of those who had been enslaved. The Qur’an refers to the permissibility of slavery only to urge the emancipation of the enslaved.

The time of the Companions was characterized by the intensification of clashes between the Muslims and the Byzantines in the West and between the Muslims and Persians in the East. The enslaving of captives was practiced in the wars of these nations. When they captured Muslims, they sold them as salves. Those early Muslims made their dealing with their enemies on a reciprocal basis. They therefore retaliated by enslaving their enemies, as it was not fair that the Muslim captives should be kept as slaves while enemy captives should enjoy their freedom.
the Arab commanders found neither Prophetic text nor Qur’anic verse prohibiting slavery explicitly. They only found that the law of dealing on a reciprocal basis necessitated retaliation. Thus if the enemy enslaved a free Muslim it was the duty of Muslims to enslave an enemy captive in compliance with the verse: [If then any one transgresses the prohibition against you, transgress ye likewise against him. But fear Allah, and know that Allah is with those who restrain themselves] (Al-Baqarah 2: 194). The Muslims fighters had therefore to enslave their enemies just as the latter had enslaved them. The sin lies with him who initiates the bad policy.
The Muslims dealt justly with their enemies in compliance with the injunctions of their religion. Having been forced to allow themselves to enslave their enemies they also tolerated the same thing from their enemies when they captured Muslims.
We may compare this wise policy in the treatment of captives with the modern practice which though not allowing the actual buying and selling of captives (as the slave trade has been abolished), yet it allows worse treatment. Captives of the vanquished party may be retained by the victor to do really hard work, while captives of the victor are released immediately after the cessation of hostilities.

Moreover, Sheikh `AtiyaSaqr, former head of Al-Azhar Fatwa Committee, adds:
the Prophet (peace and blessings be upon him) urged Muslims to show good treatment to war captives; he said to his Companions: “Treat the prisoners of war kindly.” Relating how the Companions complied strictly with this order given by the Prophet (peace and blessings be upon him) one of the prisoners of Badr, HuzayribnHumayr, states: “I was with one of Ansari families, after being taken as captive. Whenever they had lunch or dinner, they used to give me preference by providing me with bread while they’d eat only dates, in showing compliance with the Prophet’s order of treating prisoners well.

In light of the above-mentioned facts, it is crystal clear that Islam requires that prisoners of war, Muslim and non-Muslim alike, should be accorded with good treatment.