Pacemakers are small devices placed in the chest or abdomen to help control abnormal heart rhythms when the heart can't do so. They prompt the heart to beat at a normal rate. These are used to treat arrythmias, a problem with the rate or rhythm of the heartbeat.
Pacemakers don't necessarily replace the heart, they just do what the heart can't seem to do anymore, and that is to have a normal heartbeat because many diseases come along with abnormal heartbeat and could endanger your life. That's why pacemakers help alleviate those symptoms and avoid any major damage to your health.