This is a peculiarity of the cells of the myocardium, which cannot contract again immediately after contraction. This makes cramping of the heart muscle and thus the subsequent failure of the pumping function impossible.
There is an absolute and a relative refractory time. The relative, under certain circumstances, still makes a tremor of the heart muscle possible. We then speak of ventricular fibrillation or ventricular flutter, a life-threatening situation, because even then no blood can be pumped. Here an electric shock can help to return the heart to its original rhythm.
In nerve cells, the refractory time in the axon ensures that the signal cannot return to the excited site.
https://en.wikipedia.org/wiki/Refractory_period_(physiology)