Because the person is legally condemned to be put to death in a certain manner, and because while the person is alive he is in the custody of the state, the state is required by law to keep him as healthy as possible until he is executed.
I suspect if the heart attack occurs during the execution it will probably be overlooked, but if it occurs before the execution, then the inmate will be treated and brought back to health.
In other words, I agree with @SheWasAll_ .
And @asmonet: because of the ethics of taking a life, typically, most states do not require that physicians administer the drugs for lethal injection, but many states do require that physicians be present to pronounce or certify death. A staff member or an EMT hooks everything up.