In my "circles," the meaning of that is always to do with the fact that we are all capable of the very worst sins were it not for God's grace. We would say something like, "But for the grace of God, I could have committed that same act (killed someone, been a drug addict, committed suicide, been a thief, etc.).
"The story that is widely circulated is that the phrase was first spoken by the English evangelical preacher and martyr, John Bradford (circa 1510–1555). He is said to have uttered the variant of the expression - "There but for the grace of God, goes John Bradford", when seeing criminals being led to the scaffold."