Question: The questioner ‘Aboo Ahmad asks: “If one never performs Salaah (prayer) during his lifetime and is granted success to utter the two Shahaadas (Testimonies of Faith) before passing away, will they become a Muslim and be treated in the hereafter as a Muslim, and be resurrected with Muslims?”
Answer: If one utters it out of Tawbah (repentance to Allaah) and embracement of Islaam, Allaah will pardon their previous sins. Shahaadah will be accepted if one utters it out of Tawbah, Tawheed (belief in the Oneness of Allaah) and sincerity while they are acquainted with its meaning, rejecting Shirk (associating others with Allaah in His Divinity or worship) and sins sincerely. This is the true Tawbah by which Allaah wipes out past sins. However, if one utters it as a habit, it will not benefit them if they die as Mushriks (those who associate others with Allaah in His Divinity or worship). This means that they used to say it during their lifetime and before their death while insisting on worshipping graves, asking the dead for help and committing sins… read more here.