Yes, this is safe. Most pacemakers and ICDs (implantable cardioverter defibrillators) are implanted in the upper left side of the chest.
During CPR, chest compressions are done in the centre of the chest and should not affect a pacemaker or ICD that has been in place for a while. If your pacemaker has been inserted recently, there’s a small chance that the leads may be moved by vigorous chest compressions. But that’s a very small issue when compared with the CPR that could save your life.
Read the full story here.– British Heart Foundation