It's an interjection used to express:
* Surprise: "For goodness sake, you scared me!"
* Exasperation: "For goodness sake, why didn't you tell me earlier?"
* Disbelief: "For goodness sake, you're telling me you didn't know that?"
While it can sometimes be used in a slightly forceful way, it's generally considered mild and acceptable in most situations.