WRONG! Just being married to a US citizen won't prevent you from being deported if you are an undocumented foreign national, or even if you are a documented foreign national! Even legal permanent residents and visa holders may be deported if they've committed certain serious crimes or have committed immigration fraud (such as coming in to the country using someone else's passport). When I say serious crimes, I mean crimes like certain aggravated felonies, domestic violence convictions, certain drug convictions, but this list is in no means inclusive.
Undocumented foreign nationals without criminal records can't rest easy either - there is still a risk that they may be deported. The road to legalization isn't quick and easy, and it isn't cheap even if the foreign national has been married to their US citizen spouse for a long time.