Schopenhauer's critique of Kantian ethics is among the most withering in the history of philosophy. The categorical imperative — act only on maxims you could will to be universal laws — is, he argues, merely disguised egoism. It gives no reason to care about others except insofar as their welfare affects the coherence of a universalised maxim. The moral worth Kant assigns to acts done from duty alone, stripping out all sympathy and inclination, produces an ethics of cold calculation dressed up as reason. An action done without feeling for the person it helps is not more moral for being loveless — it is less.
The German word Mitleid — compassion, literally "suffering-with" — names Schopenhauer's moral foundation exactly. In genuine compassion, the distinction between self and other is temporarily dissolved: the suffering of the other is felt as one's own, not merely perceived or inferred. This is not sentimentality or emotionalism; it is a form of metaphysical insight. The person who feels compassion has, in that moment, penetrated the principium individuationis and grasped that the suffering other and the sympathising self are expressions of the same underlying will. Compassion is the ethical equivalent of the mystic's vision.
From compassion, Schopenhauer derives the two cardinal virtues of his ethics: justice (not harming others) and philanthropy (actively helping them). Justice is compassion operating as a restraint — the recognition that causing suffering is a wrong one inflicts on the same will one feels stirring in oneself. Philanthropy is compassion operating as a motive — the drive to relieve suffering one feels as partially one's own. Both are expressions of the same root impulse, differing only in whether compassion is responding to actual or potential harm.
"On the Basis of Morality" was rejected by the Danish Royal Society of Scientific Studies in 1840 despite being the only submission. Schopenhauer published it together with the Norwegian prize essay in The Two Fundamental Problems of Ethics (1841), and prefaced it with a caustic response to the Danish jury.