As a supplement to Candied Orange's very useful answer, I offer these instances of the term. From Nancy Steinbeck, The Other Side of Eden: Life with John Steinbeck (2001):
When asked about his father's attitude toward the Monterey Peninsula, John [Steinbeck, Junior] said, "He wasn't the town's [Salinas's] favorite son. They didn't like him. His works were not well received. People were outraged that his characters were loosely based on real people. He'd be confused and amused by the homage now being paid to him. There was a long time when he couldn't even get arrested in this town. Even after winning the Nobel and the Pulitzer, many local people refused to acknowledge him as an important writer. Now he's an institution.
From Todd Snider, I Never met a Story I Didn't Like (2014):
One of us said, "We can't even get arrested in this town," which is an old showbiz expression meaning, "I am not popular here."
The expression may be old in show business, but the earliest Google Books matches for the phrase are from 1986. From The Washingtonian, volume 21 (1986):
He couldn't get arrested in this town, as he likes to say. But then, in 1980, he started movie reviews. Arch-at-Large was born. [page 135]
...
"But to get to be known, you have to have a reason to be out there, and you have to have a place where people can find you—where they know you'll always be. I know that. How well I know that. Ah ha ha ha HA! For the first six years here, I didn't have a role, and I couldn't get arrested in this town. [page 182]
And from Douglas Cohen, No Way to Treat a Lady: Based Upon the Novel by William Goldman (1986):
ALEXANDRA. How dare you compare yourself to me! HOW DARE YOU! I am famous because of my work on the legitimate stage. But you ... you practice murder and pretend it's art.
KIT. It is art! THE TIMES calls me a "master of disguises."
ALEXANDRA. Poor Christopher. Whether you're a successful killer or an unsuccessful actor, you still can't get arrested in this town!
(Her light laughter reverberates in KIT's head as she disappears.)
The point of the expression is to indicate that the person is such a nobody or such a pariah that even something that anybody can do (like getting arrested) is beyond them because it would involve someone else's acknowledging their existence and humanity. An expression sometimes used to similar effect in indicating a person's unpopularity is, "He [or she] couldn't be elected dog catcher"—an implied insult because dog catching is a very low-prestige municipal job.
Update (June 18, 2023): Early newsppaer instances of the expression
A search of the Elephind newspaper database finds three examples of the expression from before 1986 (the earliest Google Books match noted in my original answer.
One very early instance involves someone actually asking a sheriff how to get arrested. From "Tries to Crash Jail: But Youth Meets with No Success," in the San Bernardino [California] Sun (May 12, 1938):
An 18-year-old transient was going to break into San Bernardino county's prison camp yesterday, even if he had to violate the law to do it.
He violated the law twice, once in sight of a police officer, and still remained free last night—much to his dismay.
...
Sheriff Shay explained that only men who had been convicted of a crime were placed in the camp.
The youth walked away with an optimistic look in his eyes.
Returning shortly afterward, he demanded of Sheriff Shay: "Say, just how does a fellow get arrested in this town anyway?"
Then he told of his futile attempt to be arrested. ...
From James Bacon, "Contradictory Is the Word for Sinatra," in the Santa Cruz [California] Sentinel (January 15, 1961):
Most of Sinatra's feuds go back a few years before "From Here to Eternity," the movie that catapulted Sinatra from a career abyss to the multi-million property he is today.
Before that movie, Frank couldn't get arrested in this town. His vocal cords had hemorrhaged; the government had slapped him with a $250,000 lien on taxes that he thought had been paid; he had separated from his wife and family and got involved in a hectic romance and marriage with Ava Gardner. A roofful of other troubles fell in on him.
And from John Bogert, "Success Made a Return Engagement," in the Santa Cruz [California] Sentinel (August 3, 1979):
The biggest part of the pain of those years was, however, her exclusion from the business.
"Here I was, the first white R and B singer to come along in years and I couldn't get arrested in this town."
The first of these three instances is, in effect, the setup question for the type of complaining statements that appear in the next two examples, although the question seems to be a sincere one. In the 1932 example, the speaker wants to get arrested and asks how to make that happen. In the 1961 and 1979 examples, the speakers are emphasizing their public invisibility by exaggerating their inability to attract notice by any means.