Agonal is the adjective form of agony. It originally meant having to do with extreme pain, and is occasionally still used in this sense, mostly in scholarly papers and other highfalutin contexts.
These days agonal is used almost exclusively in a medical context, where it means 'occurring just before or during death'. An agonal infection is an infection occurring at the end of a disease, and is usually the cause of death. An agonal clot or agonal thrombus is a clot formed while a patient is dying, agonal rhythm is a slow and erratic heartbeat that occurs in the moribund. Perhaps the best known of these agonal conditions are agonal gasps or agonal respiration, which are irregular, widely spaced gasps which often appear in heart attack victims (or more generally, cardiac arrest victims). These are actually generally thought to be a good sign, as long as the victim receives immediate CPR or other medical attention.
Calling something agonal does not mean that it was the cause of death (although it may be); it refers to something happening during the time of dying. We can also refer to the agonal period (the time of dying) and agonal conditions (that which was happening in the body during death). Premortem is sometimes used as a synonym for agonal, but premortem is also sometimes used in a wider sense to include things that happened before the patient entered an agonal state, even things that may have happened years before ("the patient was diagnosed as diabetic premortem").