Praise be to Allaah.
Muslim (710) narrated from Abu Hurayrah that the Prophet (peace and blessings of Allaah be upon him) said: When the iqaamah for prayer is given, there is no prayer except the prescribed prayer.
This hadeeth indicates that once the iqaamah has been given for prayer, then no one should start to offer a naafil prayer.
Ibn Qudaamah (may Allaah have mercy on him) said: When the iqaamah for prayer is given, do not be distracted from it by naafil prayer, whether one fears missing the first rak'ah or not. This is the view of Abu Hurayrah, Ibn Umar, Urwah, Ibn Sireen, Sa'eed ibn Jubayr, al-Shaafa'i, Ishaaq and Abu Thawr. Al-Mughni, 1/272
Some of the scholars also quoted this hadeeth as evidence that the person who is offering a naafil prayer when the iqaamah is given should cut short that prayer.
Al-Haafiz al-Iraaqi said: His words there is no prayer' may be interpreted as meaning that he should not start a naafil prayer in that case; or it may be interpreted as meaning that he should not be distracted by a naafil prayer, and if he had started it before the iqaamah then he should cut it short so that he can catch up with the opening takbeer [with the imam], or that it is invalid in and of itself even if the worshipper does not cut it short. It may be understood as meaning both of these.
It was narrated from Shaykh Abu Haamid, one of the Shaafa'is, that it is better to stop the naafil prayer if completing means that he is going to miss the opening takbeer with the imam. (The words of al-Iraaqi were quoted by al-Shawkaani in Nayl al-Awtaar, 3/91).
This was also stated in a fatwa issued by the Standing Committee, when they were asked:
Is it permissible to cut short a naafil prayer and join the opening takbeer with the imam, or should one complete the naafil prayer?
Yes, if the iqaamah for an obligatory prayer is given, then you should cut short your naafil prayer so that you can join the opening takbeer with the imam, because it was proven that the Prophet (peace and blessings of Allaah be upon him) said: If the iqaamah for prayer is given, then there is no prayer but the prescribed prayer.
Fataawa al-Lajnah al-Daa'imah, 7/312
Shaykh Ibn Uthaymeen (may Allaah have mercy on him) said that the correct view [?] is that if the iqaamah for prayer is given whilst the person is still in the first rak'ah of a naafil prayer, then he should cut it short; if that happens when he is in the second rak'ah then he should complete it quickly and not cut it short.
He said (may Allaah have mercy on him):
What we think concerning this matter is that if you are in the second rak'ah, then you should complete it quickly, but if you are in the first rak'ah, then you should cut it short. Our evidence for that is the words of the Prophet (peace and blessings of Allaah be upon him): Whoever catches up with one rak'ah of the prayer has caught up with the prayer (narrated by al-Bukhaari, 580; Muslim, 607). So the person who has prayed a rak'ah before the iqaamah for prayer is given has caught up with a rak'ah that is free of any impediments, which here means the iqaamah for prayer, so he has caught up with the prayer by doing a rak'ah before the prayer becomes disallowed, so he should complete it quicklyâ€¦ Then he said: This is the view that reconciles all the evidence.
Al-Sharh al-Mumti', 4/238
If he cuts short the naafil prayer he should do so without saying the tasleem.
The Standing Committee was asked (7/312): If the iqaamah for prayer is given and there is a person who is doing two rak'ahs of Sunnah prayer or Greeting the Mosque, should he cut short his prayer so that he can offer the obligatory prayer with the congregation? If the answer is yes, then should he say the tasleem when cutting short his prayer, or should he cut it short without the tasleem?
The more correct of the two scholarly views is that he should cut short that prayer, and there is no need to say the tasleem when doing so. Then he should join the imam.
And Allaah knows best.