´It was narrated from Ibn 'Abbas that:` The Prophet said: "Whoever hears the call and does not come, his prayer is not valid, except for those who have an excuse."
Hadith Referenceسنن ابن ماجه / كتاب المساجد والجماعات / 793
Narrated Ibn 'Abbas (RA): Allah's Messenger (ﷺ) said: "Whoever hears the call for prayer and and does not come (to the mosque for prayer), his prayer will not be accepted from him, unless he has a (legitimate) excuse." [Reported by Ibn Majah, ad-Daraqutni, Ibn Hibban and al-Hakim. Its chain of narration meets Muslim's conditions, but some Hadith scholars held that the stronger view is that it is Mawquf (saying of a Companion)].