Les Miserables, which Hugo composed from the late 1840s to 1862 during his exile (for criticising the government), integrated his feelings about the political situation, his memories of the barricades of 1848, and his republican ideals. The novel denounces the degradation of the urban working-class and society's mistreatment and neglect of the poor, especially women and children.
Here is an excerpt from the enotes on Les Miserables in answer the second part of your questions, relating to Jean Valjean:
"Hugo draws a clear distinction in the novel between those who choose crime because they are corrupt and those who are driven to it by poverty and desperation. On the one hand, there is Thenardier, who is by nature "highly susceptible to the encroachments of evil." On the other, there is Valjean, who stole only to save his family, and Fantine, who suffered for protecting her own child. The narrator blames society's indifference and injustice for the situation of those who fall into the latter category."