In order to avoid paying compensation, an airline must be able to show the regulatory authorities that 'extraordinary circumstances' led to the delay.
Although there are guidelines as to what DOES qualify as 'extraordinary circumstances' (such as air traffic management decisions, political instability, adverse weather conditions and security risks) and what DOESN'T qualify (such as most technical problems and internal strike action), it's inevitable that there will be occasions where there are no relevant guidelines and where a ruling from the regulator would be required if there was any dispute over the matter:
https://europa.eu/youreurope/citizens/travel/passenger-rights/air/index_en.htm
However, in the event of such a dispute, I feel confident that the knock-on effects of a medical emergency would be regarded as 'extraordinary circumstances' by the regulator.