Interesting question ...
This sentiment or claim has been popularized under diverse phrasings for a long time. The general point has been used with reference to society, civilization and government.
In the 20th century it was widely mis-attributed to Gandhi, who seems to have actually said something similar with respect to treatment of animals:
https://atkinsbookshelf.wordpress.c...easured-by-how-it-treats-its-weakest-members/
Many recent attempts to trace the origins of this quote dig back only as far as the late 19th century:
“A society should be judged not by how it treats its outstanding citizens but by how it treats its criminals.”
― Fyodor Dostoyevsky
https://www.goodreads.com/quotes/7646988-a-society-should-be-judged-not-by-how-it-treats
However ... The sentiment's general form (above and beyond 'criminals') can be found in the mid-19th century:
"If a test of civilization be sought, none can be so sure as the condition of that half of society over which the other half has power."
- Harriet Martineau (English author)
... and in a concise form it can be found in the 18th century:
"A decent provision for the poor is the true test of civilization."
- Samuel Johnson
It wouldn't surprise me to find even earlier quotations that essentially make the same point.