Victor Hugo's novel arose out of many years of walking the streets of Paris and observing the plight of the poor. As social unrest grew across Europe over the course of the nineteenth century, Hugo felt it was time to expose social injustice and focus on the plight of those without adequate resources.
Unlike other novels of the time, Les Misérables places the poor in the spotlight rather than the margins as a way to raise sympathy for them. Hugo focuses on characters such as a poor thief and a prostitute rather than the kings and nobles of classical literature to show that the poor are more sinned against than sinning.
Jean Valjean is sentenced to nineteen years of hard labor for stealing a loaf of bread to feed his hungry children, an act not of depravity or greed but of desperation. Valjean, before being redeemed through love, feels understandably bitter and angry that the weight of the law falls so heavily on struggling people like himself while the rich, in his eyes, seem to get away with creating the cruel conditions which make it almost impossible for the lower classes to survive.
Likewise, Fantine becomes a prostitute, a criminal occupation, because her lover has left her. This is the only way she knows to survive. Although she participates in a job considered dirty and sinful, her heart and soul are pure.
Through such sympathetic characters as Valjean and Fantine, Hugo argues that social conditions need to become more just to allow the poor to survive.