My question is that I woke up for Fajar and turned off my alarm but something came I again slept...I don't know then again got up went to masjid there imam was in second rakat sitting...so he said salam . I prayed sunnah first then fard but one guy said your fard or sunnah are not accepted but when I left from home sun was already coming up so technically it was already when I arrived at the masjid...so would my salaah be okay because of the hadith that if you forget or sleep pray immediately.
If you have seen the Imam praying with the Jama‘a and he was sitting, then you could have joined the prayer, namely by sitting down too (if you had the time), and afterwards made the Sunnah prayer:
“The one who misses the Sunnah prayer before Fajr may offer it after Fajr prayer.“ The evidence for that is the report narrated by al-Tirmidhi (422) and Abu Dawud (1267) from Qays ibn ‘Amr who said: The Messenger of Allaah (peace and blessings of Allaah be upon him) came out when the iqaamah for prayer had been given, and I prayed Fajr with him, then the Prophet (peace and blessings of Allaah be upon him) finished and found me praying. He said: “Take it easy, O Qays. Two prayers together?” I said: “O Messenger of Allaah, I did not pray the two rak’ahs before Fajr.” He said, “No, then.” According to the version narrated by Abu Dawood, the Messenger of Allaah (peace and blessings of Allaah be upon him) remained silent. This hadith was classed as Sahih by Al-Albani in Sahih At-Tirmidhi.
Al-Khattabi said: “This shows that the one who misses the two rak'ahs before the obligatory prayer may offer them after the prayer, before the sun rises.“ From ‘Awn al-Ma’bood“
As I understand it, if you have seen the Jama‘a praying, and you did not pray with them, then how come you can be late or that you would have missed Fajr if you right after that prayed? Because the Jama‘a would not pray close to the sunrise.
“Whoever catches up with a rak’ah of the prayer, has caught up with the prayer.” Al-Bukhari (580)
And he (peace and blessings of Allaah be upon him) said: “Whoever catches up with a rak’ah of Fajr prayer before the sun rises has caught up with Fajr, and whoever catches up with a rak’ah of ‘Asr prayer before the sun sets has caught up with ‘Asr.” Al-Bukhari (579)
There are various views that you can even reach it if you just made it to Ruku; for more information:
And, it is narrated:
In Abu Dawud (564): ”Whoever performs ablution and heads to the mosque and finds that the people had already prayed, Allah gives him the same reward as those who actually attended the prayer and this does not reduce the reward of those people (in anyway).“