David Friedman discusses a few of the legal systems under which torture was not only possible, but omnipresent:
The use of torture to extract information is not a new idea. Under both Athenian and Roman law, slave testimony could only be taken under torture. Presumably the theory was that slaves were interrogated in order to get evidence against their owners, the owner had ways of putting pressure on the slave, so torture was needed to get the slave to tell the truth. In Imperial Chinese law, not only the defendant but also witnesses could be tortured. In that system, and I think also in some legal systems of medieval and renaissance Europe, a defendant could only be convicted by his own confession. Torture was one way of getting it.
The argument against torture, that the victim will say whatever he thinks will end it whether true or false, is also old — people in the past were not stupid. Our main source of information on Athenian law consists of orations written by professional orators to be memorized by a party to a law suit in a legal system where there were no lawyers and each party had to represent himself. There is one oration which claims that slave testimony under torture is perfectly reliable, that there has never been a case where it turned out to be false. There is another making the obvious argument on the other side, that such testimony is worthless since the slave will say whatever the torturer wants him to say.
They were both written by the same orator.
People in other legal systems that used torture were also aware of the problem. There is a collection of Chinese cases compiled in the 13th century for the use of magistrates. Many of them are cases where a clever judge realizes that an innocent person has been forced to confess under torture and figures out who is really guilty.
That raises an obvious question — if they saw the problem with torture, why did they continue to employ it? One answer is that extracting information might only have been an excuse, that the real purpose was to punish someone without having first to convict him. That is a possible explanation in some contexts, including the current case of torture by the CIA. But it does not explain contexts where the person being tortured was not the suspect but a potential witness.
A second possible explanation is the belief that a competent interrogator could distinguish a real confession from a fake one. That strikes me as the most likely explanation in the Roman and Athenian cases, where it was the defendant’s slave, not the defendant, who was being interrogated.
A third explanation is that torture might produce information that could be checked. That is the situation in the hypothetical cases sometimes offered in defense of the use of torture — the suspect is being forced to say where the kidnap victim, or the terrorist time bomb, is concealed. More plausibly, to say where the loot is hidden.