In the late 1920s it was called Baumes Law or X-strikes and you're out as it spread across the states. It was all a reaction the Prohibition, like the drug war is today. When the states realized the laws left the convicts nothing to lose, and because of so many prison riots, the laws were repealed or neglected. California already had an "habitual criminal" law before passing 3-strikes. It was rarely enforced.
Clarence Darrow wrote about that period in history:
In America another condition brought about a psychology that led to
all sorts of violence. While the soldiers were fighting in Europe
the United States adopted its drastic, absurd prohibition law,
which was resented by substantially half the population of the
land. In a short time the partial enforcement of this law filled
our prisons to overflowing, and many defenseless men and women were
shot down on mere suspicion. The result of all this has been what
any student of human nature or machinery of government might have
foreseen. From the time of the passage of the Eighteenth Amendment
and the Volstead Act the citizenry has waged almost open warfare.
Of course men did not stop drinking. Neither did they cease to buy
and sell. Necessarily the laws led to illicit manufacture and
importation of intoxicating liquor. This logically led to the
organization of a new industry. So long as the business was
outside the law the dealers were obliged to make laws of their own.
Customers who bought illicit liquor did not hesitate to censure and
condemn those who sold it. The law itself, with the hypocrisy that
goes with that sort of legislation, made it a crime to sell, but
left it perfectly legal to buy and to drink.
The open violence, the crowded prisons, the state of anarchy that
prohibition has brought about led to a mad and senseless crusade
against crime. New penal statutes were passed, prison terms were
lengthened, courts and juries, in obedience to the mania, convicted
defendants almost indiscriminately. Many innocent persons were
sent to prison and executed in this carnival of hate. Such
infamous acts as the Baumes Law--providing that a fourth offender
should be sent to prison for life--were passed in most of the
States. One woman in Michigan was sent to prison for life for
selling a half-pint of whiskey. Many others, whose first offenses
were committed when mere children, were sent to the penitentiaries
for life for an act that carried with it no feeling of wrongdoing.
To be sure, in this madness mistakes were made. Men and women who
were guilty of no crime often suffered the severest penalties.
Judges meted out the most outrageous sentences. New statutes
created new crimes, increased the penalties, and destroyed age-long
safeguards for freedom. Boards of parole and pardon ceased to
function. The unfortunates in prisons felt that there was no
chance for regaining liberty once the prison doors closed upon
them. This hopelessness kindled prison revolts, which led to
fearful slaughter, to the destruction of all that the years of
earnest work had done to modify conditions by building up humane
prisons, caring for juvenile offenders, and giving even the
condemned hope or opportunity once more to be free.
Title: The Story of my Life (1932)
Author: Clarence Darrow