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.
If a person wants to perform the prayer, he has to remove away from him anything that might preoccupy him or disturb him in performing the prayer with reverence and fear, especially if what disturbs him is the ringing of the phone that attracts people’s attention.
Therefore, we advise holders of mobile phones not to bring their phones to the prayer or –at least –to turn them off so that they will not be disturbed and will not disturb other people performing the prayer and to keep the houses of Allah free from that kind of music (ringing of the phones). Which
In case a person starts praying and he forgot to turn off his mobile, and the mobile rings during the prayer, then he has to turn it off to stop that disturbing noise.
Of course, there is no harm in making some movements when trying to turn off the mobile, because it is a slight movement and it is done for the interest of the prayer. This kind of movement can be forgiven.
However, it is not permissible for someone to answer the phone during prayer, as that makes the prayer void. It is absolutely unacceptable for a Muslim to deliberately behave in a way that makes the prayer invalid, like speaking unnecessarily, or turning one’s back to the direction of Qiblah and other actions that may make the prayer invalid.
In case there is a preponderant interest in behaving in a way that could make the prayer invalid, then there is no sin in behaving as such; it could even be an obligation to stop the prayer in order for instance to save a honourable life.
The scholars differered in opinion regarding talking during the prayer for the purpose of getting the prayer correct, whether or not this renders the prayer void.
The movements in prayer could be of a lesser degree of seriousness than talking during the prayer.
The scholars set three conditions that make the prayer void:
1) Doing the action (that makes the prayer void) for a long time.
2) Doing it without necessity.
3) Doing the action in a continuous manner.
If these three conditions are not present in an action, then the prayer does not become void.
For more benefit, please refer to Fataawa 345934, 350416, and 361123.
Allah knows best.