Its use was gradually abolished as various courts, legislatures or prison administrations created rules against it. You will sometimes read that it was abolished by the US Supreme Court, but apparently this is a myth, the Supremes have never ruled on prison spanking and the US District Court rulings are contradictory so the last word has not yet been spoken on the subject, however the punishment is no longer in use anywhere in the US or Canada. Paddling of juveniles in state custody is specifically permitted by law in some states (such as Tennessee), however it is forbidden by administrative rules everywhere, even where high school students can be paddled.
One of the District courts found the practice unconstitutional, but another ruled that it was legal as long as it was not too severe and did not involve unnecessary humiliation, specifically prohibiting requiring inmates to remove all of their clothing and receive the punishment totally naked (as seems to have been the usual practice) on the grounds that this wasn't necessary to increase the pain of the spanking--the implication being that making the man pull his pants and underpants down was acceptable, to ensure a good sting. Until the last few decades prisoners were often required to be naked a great deal of the time, as this makes them more docile and easier to handle.
I've always been surprised that children have been the last to be protected from corporal punishment while convicts and men in the military can no longer be spanked. I'm not exactly arguing that spanking in prison would be a great thing, but a moderate and well-regulated use of a light, stinging paddle or belt-sized strap on adult male convicts as a minor administrative punishment is clearly more humane than what's going on in US prisons currently, where thousands of convicts are kept in solitary confinement 23 hours a day. Even in the infamous Southern prisons that used the strap (and other, more brutal abuse) freely, prisoners lived in barracks type housing and had a remarkably active social life.
Surprisingly, in Southern prisons the strap was most often wielded by convicts, as there were few guards and the prison was run by a hierarchy of trusties. This could lead to abuse as the trusties were horny and wanted sex from the handsomer prisoners, who could be spanked at the whim of the trusties and thus had little choice in the matter.
Men spanked in prison were often laid or held over a barrel, which is likely the origin of the expression "to have someone over a barrel", meaning to have him at your mercy. The Jamaican film "The Harder They Come" features a scene where the hero is given three court-ordered lashes with a tamarind switch on his naked behind, over a barrel, probably one of the most realistic scenes of Judicial CP in any film.
For a couple of fairly authentic prison strappings, see the Robert Redford movie Brubaker. The film is wildly incorrect about the details of prison life and even shows the prison (in the early 1960s) as racially integrated: one of the men we see get his butt whipped is black, another white, but the real life events on which the movie is based took place at a white men's prison. The bare assed strappings in the film, however, are surprisingly realistic.