Healing and moderation share a root. Remedy comes from Latin remedium — 'a cure, a means of restoration' — composed of re- ('again') and medēri ('to heal'). The PIE root *med- meant not 'to heal' specifically but 'to take appropriate measures', and from this idea of measured action grew an entire vocabulary.
Medicine is the practice of appropriate measures for the body. To meditate is to take the measure of one's thoughts. Modest originally meant 'keeping to proper measure'. Moderate means 'within due measure'. The word remedy sits among these siblings as the one that measures out a cure.
The re- prefix in remedy suggests recurrence — a remedy addresses a problem that has returned or persists. A single treatment is medicine; a remedy implies the condition needed addressing again.
Legal English adopted remedy early. A legal remedy is the court's cure for an injustice — damages, injunctions, specific performance. The metaphor treats wrongdoing as a sickness and the court's order as medicine. This legal usage was already present in Latin: Roman law used remedium for judicial redress.
The word entered English through Anglo-French in the 13th century, carrying both senses. It has never lost either one. A pharmacist offers remedies for coughs; a lawyer offers remedies for breach of contract. In both cases, something measured and appropriate is applied to something wrong.