The treatment of prisoners of war is dictated by the Geneva Convention (three of them with updates until Aug. 1949). These were agreed to by all countries and were used in the treatment and trials of the Nazi prisoners tried at Nuremberg. The most recent version can be found here:
https://cil.nus.edu.sg/rp/il/pdf/1949 Geneva Convention (III) Relative to the Treatment of Prisoners of War-pdf.pdf
There s a lot of information in this document but for example it states that:
Article 13
Prisoners of war must at all times be humanely treated. Any unlawful act or omission by the
Detaining Power causing death or seriously endangering the health of a prisoner of war in its
custody is prohibited, and will be regarded as a serious breach of the present Convention. In
particular, no prisoner of war may be subjected to physical mutilation or to medical or scientific
experiments of any kind which are not justified by the medical, dental or hospital treatment of
the prisoner concerned and carried out in his interest.
Article 103
Judicial investigations relating to a prisoner of war shall be conducted as rapidly as
circumstances permit and so that his trial shall take place as soon as possible. A prisoner of war
shall not be confined while awaiting trial unless a member of the armed forces of the Detaining
Power would be so confined if he were accused of a similar offence, or if it is essential to do so
in the interests of national security. In no circumstances shall this confinement exceed three
months.
In my mind, neither one of these two articles were complied with in the case of the alleged terrorists imprisoned at Gitmo.