Heart attacks are usually caused by narrowing of the blood vessels in your body and heart so when a stent is put in your arteries or heart it prevents future blood clots and keeps the blood flowing through your heart and bodies blood vessels like it should.
The stent helps prevent future heart attacks by reducing the chance of future blood clots so if you get a stent put in after a heart attack then you're less likely to have another heart attack anytime soon.
It's still possible to have another heart attack after a stent but less likely because the stent keeps the blood vessels open like they should be.