All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The Prayer is a great act of worship, and it is not permissible for anyone to interrupt it or do what nullifies it, even if that thing is a good deed. In an authentic Hadeeth, the Prophet, said: "The Prayer takes one’s whole attention." [Al-Bukhaari] However, there are exceptions in cases of extreme necessity, such as saving a person from an impending danger, etc. In such cases, one may stop praying in order to prevent the greater evil from happening by committing the lesser evil (interrupting his prayer). Tarh At-Tathreeb fi Sharh At-Takreeb stated, when mentioning the incident of the Bedouin who urinated in the mosque, that one should hasten to forbid what is wrong and teach the ignorant, and that one should not delay forbidding it once he becomes aware of the evil. However, if the evil happens while he is praying then he should delay forbidding (or teaching) until he concludes the prayer, as mentioned in a Hadeeth reported by Al-Bukhaari. The rest of this Hadeeth mentions that after the Prophet had finished his prayer he forbade him from doing this evil (and taught him). This is the case if the harm from that evil doesn't go beyond the person to affect others. However, if its harm goes beyond the person and harms others, such as seeing a person killing another one without due right and so on, then, it becomes obligatory upon him to interrupt his prayer and prevent as much as he can from that evil.
Allah Knows best.