We first witness Jean Valjean stealing bread through the eyes of the baker. The baker, Maubert Isabeau, sees the bakery window being broken:
An arm passed through a hole made by a blow from a fist, through the grating and the glass. The arm seized a loaf of bread and carried it off.
It is telling that Isabeau perceives Valjean not as a human being but as an "arm" stealing a loaf of bread. This characterizes how people like Valjean are dehumanized.
It is not until he is arrested, sentenced, and in the process of being sent off to the galleys with an iron collar attached to his neck that Valjean reveals he stole the bread to feed his children. He does not use words, but weeps and makes gestures that show he committed the crime for the sake of his seven children. Already, at the beginning of his sentence, he is starting to realize his fate is harsh for such a minor crime.
Valjean is initially sentenced to five years of galley labor, but his time in prison expands to nineteen because he attempts to escape. As the narrator states:
In October, 1815, he was released; he had entered there in 1796, for having broken a pane of glass and taken a loaf of bread.
Valjean realizes that his sentence was unjust. During his time in prison he loses track of his children, his sister, and his former life. He becomes a gloomy and bitter man.
Hugo makes the point that Valjean's sentence is not atypical. Many poor men like him were punished with undue harshness for minor crimes.