I'm no law student, but I think I know enough to say the prosecutors had almost no case against Stanley. There were no witnesses that saw him at the homeless shelter, no fingerprints, no DNA, and no security camera footage. But then again, this isn't Law & Order...
For sure, that happens to kids a lot. And when they're poor, in "bad" neighborhoods and/or with a reputation it definitely happens. They go through so many of those cases they probably stop seeing them as people.
If I remember correctly, in the book Stanley, who didn't have a lawyer, told the judge the shoes "fell out of the sky". You can imagine how that would seem a lie, as it was a pretty stupid thing to say. Stanley was arrested pretty far away from where he found the shoes, and therefore pretty far away from the bridge Zero dropped them off. And Stanley either never made the connection/noticed or neglected to mention that he'd been passing under a bridge at the time the shoes fell on him, so saying "the shoes fell out of the sky" would imply that they literally fell out of the sky. He had no chance really, as he was caught red-handed, had no lawyer, and wasn't really smart enough to just lie and say he found them on the ground.
It doesn't necessarily mean that he was stupid. He was just a kid who told the truth about what happened, without stopping to consider whether anybody would believe him.
Another thing, Stanley did not have an attorney at the beginning of the film. He got an attorney later after his father made his discovery and could afford an attorney for him. The public defender would not have had much to work with. He was caught with the stolen shoes and claimed they fell out of the sky. Everybody would have assumed he stole them. Even if he had not, he was in posession of stolen property, which in Texas is just as bad as actually stealing the property.