The hey am duhkham anagatam sutra speaks of the imminent pains and how to get rid of it. The past has already gone by, nothing can be done to it. But one can always mend the future actions by following the preventive yogic art. A healthy body and mind leads one to come out with a calmed mind, that is capable to withstand the spiritual light without any hindrances.
heyam to be avoided, to be rejected, to be prevented
duhkham sorrow, agony
anagatam not yet come, future, unknown
The pains which are yet to come, can be and must be avoided.
Past pain is over. However, the pain that one is in the process of experiencing cannot be avoided, but can be minimised to some extent by yogic practice and discriminative knowledge. Unknown future pains can be forestalled by cohering to yogic discipline now.
Patanjali says that yoga is a preventive healing art, science and philosophy, by which one builds up robust healthy conditions in body and mind and constructs a protective strength with which to ward off or counteract afflictions that are as yet unperceived afflictions.
Moreover, strong health and a stable mind will facilitate one to face the wonder of wonders - the spiritual bliss - if and when, thanks to the good actions in former lives, the spiritual gate is set open.
One should remember that even Arjuna, hero of the Mahabharata, had to beg Lord Krishna to charm him with divine perception in order to face the divine light which his ordinary eyes was not able to bear. Patanjali warns here of the pitfalls in spiritual growth, and advises one to stabilise the body and mind so that one might not be exhausted when spiritual light dawns.