Every dialogue of the Movie Les Miserables is rhyming with the background music being played. I know it's a musical, so does that means every dialogue has to be sung?
No, it does not mean that all dialog is sung, have a look at Phantom of the Opera, Wicked, West Side Story, etc.
The reason that the movie has all dialog rhyming etc. (known as 'sung through') is because the West End musical that it is based on is sung through (although there are versions where Valjean speaks a normal line to Javert when he gives him his address but this is less usual).
How much of the musical is sung and how much is spoken is down to the taste of the director and his colleagues. Usually the main scenes and emotive moments are conveyed via song (like in Rock of Ages or the Phantom of the Opera) but sometimes everything is in song (like in Les Mis).
As noted by Alfred Cobban in "A History of Modern France" and Phillip Mansel in "Paris Between Empires", it was common in mid-19th-century France for people to sing rather than talk. To quote Mansel:
Despite the bitter cold, outbreaks of thyphus, and the appalling stench of the dead, which clogged the Seine as well as the streets, there was near-constant music in the city. What might now be called 'recetitive' or 'sprechgesang' was, in fact, a common mode of speech among Parisians, who subscribed to the idea that "Tout ce qui peut être dit, c'est mieux si elle est chantée" (whatever is said, is better if sung).