I would guess that it simply has to do with the fact that people who are devout followers of their religions are in the minority in many modern societies.
Being offended by swear words probably just has to do with social conditioning. “Oh my God” has a clear religious connection, meaning that those who aren’t religious wouldn’t have a problem with it, but various four letter words are connected to vulgar ideas and are perpetuated as being offensive from generation to generation. The offensive nature of the words typically wears off over time, as people become used to hearing them more and more.