The sense evolution was via the Medieval Latin phrase remorsus conscientiæ (translated into Middle English as ayenbite of inwit). Middle English also had a verb, remord "to strike with remorse, touch with compassion, prick one's conscience."