Dr. Muzammil H. Siddiqi, President of the Fiqh Council of North America, states: “Islam is to affirm all that is taught by Prophet Muhammad (peace and blessings be upon him). A person becomes non-Muslim when he/she knowingly rejects any thing that is taught by the Prophet and is confirmed by authentic reports and the consensus of Muslim scholars.
If one commits a sin by ignorance, mistake or forgetfulness, it would not make a person non-Muslim.