"The Cop and the Anthem" was first published in 1905. That was well over a century ago, and America was much different. There was no electric lighting, no automobiles, no indoor plumbing. O. Henry frequently mentions horses in his stories, such as in "A Municipal Report" where the agent is taken to Azalea Adair's house in a horse-drawn buggy.
O. Henry himself was born around the time of the Civil War and died in 1910. He describes the world as he saw it, and his readers of the time must have seen it in pretty much the same way. There was no social security, no Medicare, no unemployment compensation. Medical knowledge was primitive, and most of the antibiotics and immunizations were undreamt of. Tuberculosis was rampant. Many child died before they could reach maturity, and many women died in childbirth.
O. Henry spent three years and three months in prison for embezzlement--and prisons were very tough places in those days. Read Jack London's little-known story "The Star Rover" for a description of prison life. The last part of Theodore Dreiser's novel Sister Carrie, published in 1900, describes conditions at the bottom of the social ladder in the descent of George Hurstwood from a prosperous and self-confident businessman to a panhandler in New York City and finally an anonymous suicide in a flophouse.
Writers like O. Henry, Charles Darwin, Jack London, Stephen Crane, Theodore Dreiser, and a great many others helped elevate the public consciousness regarding the lowest class of society. Nowadays most Americans believe that the poor should be provided with at least a minimal amount of food, clothing, shelter, and medical care--a so-called "safety net." Consequently these things are available to the homeless today.
O. Henry treated Soapy with humor and irony because that was his style. He was one of the many writers who was influenced by the great Charles Dickens, and it was a distinguishing characteristic of Dickens that he described misery with humor and irony. O. Henry was no more indifferent to the sufferings of the unfortunate than was Dickens. O. Henry had experienced a great deal of suffering himself in his relatively short lifetime. The same humor and irony can be seen in his best-known stories, including "The Gift of the Maji," "The Cop and the Anthem," "After Twenty Years." and "A Municipal Report." Perhaps his intention was not so much to make his readers more socially conscious and politically militant as it was to provide a spark of cheer and humor to help them through their own lives of toil and anxiety. It was a cold, cruel world for most people in 1905.