How did torture go from very widespread (universal?) in the early modern era to almost universally banned today? What countries were first to ban it?

Well, to start with the 8th amendment, it's interesting to take the position of some legal scholars such William Stuntz (in The Collapse of American Justice) and consider the precise phrasing; in many ways, it's cruel and unusual punishment that is proscribed, and not the one or the other as is commonly thought. This isn't to assign a sweeping moral judgment to a wide variety of people in different places and times who are all American decisionmakers, but rather to find a theory of torture where you stop treating horrific acts, both unofficial and official, as anomalies and individual excesses or (successfully) technologically-sterilized acts.

So, to continue with the US theme, you have to consider the feedback loop between foreign policy writ large and domestic policy (small and large) to have a comprehensive picture of where torture sits in a culture. Towards that end, it's useful to begin with Lincoln's general order 100 AKA the Lieber Code, as per John Fabian Witt's interpretation in Lincoln's Code. Once you look at the specific wording and execution surrounding what appears to be a prohibition of torture, you understand that in fact it's creating a category of prisoner beyond POWs, a category of insurgent or irregulars or not-really-uniformed opponents, where there's a whole range of options for dealing with them. In essence, once the Union was nominally claiming a region, any non-surrendered Confederate soldiers were now personnel in rebellion, as were any people assisting them. Thus you see the prototyping of the language that would allow the order to be the model for the torture/prisoner treatment language in the Hague Conventions of 1899 and 1907, and there was no conflict apparent for a US military in the process of pacifying the Phillippine "insurgents" by any means necessary.

There's a long line of similar events in subsequent military endeavors, all the way through to events well within the 20 year window outside of the purview of this subreddit. Again, the question is not to find a deliberate conspiracy to commit such things as part of a pro-torture stance that is recognized as such by its perpetrators, but rather to admit that the opposite view is no closer to the truth (Laws and regulations ban this nominally and are repeatedly ignored, but they are all flukes).

Which brings us back to domestic questions, where I think the must-have book for anyone interested in the topic is Darius Rejali's magisterial Torture and Democracy. The key point uniting his take on abusive Chicago cops in the 60s and French gendarmes in Algiers in the 50s is that democracy preventing torture is no more the case than democracy preventing war, as the old saw would have us believe. In fact, his argument is that democracies tend to build complex edifices to support torture in plain sight in accordance to what the majority demands, whether it's notorious American "no visible marks" torture or the rather more visible approaches in other places.

So, to answer your question, under the assumption that torture doesn't really go away so much as change shape to accommodate new ideas and new societal stresses that "justify" such measures: the architects of re-shaping torture look a lot like Franz Lieber, author of the 1863 code. Well-intentioned people, by all accounts, who think they are faced with an unprecedented challenge and will be able to pick and choose what they need from what is clearly immoral via a legally prescriptive, ideally technologized or pseudoscientific ways to do what "needs" to be done in the face of that challenge. This experimentation loops back and forth between foreign efforts and work on marginalized groups domestically, as was shown when former torture-accused police officers were brought in as interrogation advisors in the War on Terror.

Even by this admittedly dark vision of the place of torture in modern life, the bans do matter because there is value in making people at least narrow what is permitted as humane or normal away from terrible deeds. But the central goal of torture is perceived by these scholars as the generation of terror, regardless of the short-term targets, and the regulation of it in these measures is designed to preserve the right amount of terror aimed at the right people while insulating society at large (always unsuccessfully, historically) from the moral hazards it generates.

/r/AskHistorians Thread