That is a very complicated question. If you visit the FDA site they have information on what are called "elective replacement indications", as well as full discussions on the various reasons for ,pacemaker failure. They also have detailed physician's manuals on various models of Pacemaker.
That depends on the type of the pacemaker/defibb and on the amount of work it is to do during its life.
The pacemaker has to be replaced when the battery is nearing its end of life.
The battery of a pacemaker that only now and again pulses the heart lasts much longer than that of a pacemaker that is constantly giving pulses.
The normal range of pacemaker lifetime is between 5 and 10 years.