There are two types of compassion. One is the compassion of the wise, one is that of the ignorant.
An ignorant person's compassion is on the fruit of an action whereas a wise person's compassion is towards the non-availability of knowledge. Compassion for suffering shows ignorance. Suffering comes because of karma, and if you believe in karma, where is compassion? One reaps the fruit of one's actions.
If a judge has compassion for all the offenders then the jails will be empty. At the same time, are the judges cruel to the offenders? No; the judges' compassion is for the non-availability of knowledge, not for the suffering of the criminals. It is their karma.
Often people think compassion is an act, an action. Know that compassion is your very nature. Then you will see that karma and compassion are not contradictory but complement each other.
Suppose two people come to a hospital. One is suffering from starvation, the other is ill from overeating. What type of compassion should the doctor have towards each of them? This is a riddle for you to solve!