Since caste and class are related in the novel, I will answer both together. The novel concerns a couple, Ammu and Velutha, who break the Love Laws--a touchable Ammu (upper class/higher caste) falls in love with an untouchable Velutha (low class/ casteless). Roy portrays this relationship with vivid detail, showing their physical and emotional love. This relation is taboo in the Indian society of Kerala where the novel takes place, so much so that when Velutha's father finds out about the affair, he offers to kill his own son. Ammu ends up as an outcast from her family and town as a result of this relationship, and Veluthah is beaten fatally by police officers, who know that they can use excessive force because Velutha is an untouchable.
In the poignant ending of the novel, we see what a beautiful love Velutha and Ammu might have shared with each other had the caste system been ignored by the society in which they lived. Instead, their moments of love cost them everything, including the childhoods of Rahel and Estha, who loved both their mother Ammu and Velutha.
If you compare this relationship to those that stayed within the confines of the Love Laws, you will see the harsh critique that Roy is making of the caste system. She shows a horribly abusive relationship between Mammachi and Papachi, a marriage that is sanctioned by society. And, we see the deadening impact of a loveless life on an individual through Baby Kochama. Neither seem viable alternatives to the love between Velutha and Ammu.