Cardioversion is a medical procedure used to restore a normal heart rhythm in patients experiencing arrhythmias, such as atrial fibrillation or atrial flutter. It can be performed using electrical shocks or medication to correct the abnormal heart rhythm effectively and safely.