Electrical cardioversion is a medical procedure used to restore a normal heart rhythm in patients with certain types of abnormal heartbeats, such as atrial fibrillation or atrial flutter. It involves delivering a controlled electrical shock to the heart through electrodes placed on the chest, effectively resetting the heart's electrical system.