doctor may recommend a temporary pacemaker when you have a slow heartbeat (bradycardia) after a heart attack, surgery or medication overdose but your heartbeat is otherwise expected to recover. A pacemaker may be implanted permanently to correct a chronic slow or irregular heartbeat or to help treat heart failure.
