Being surprised.
Something you couldn't/didn't think of.
Something you can't agree on.
This phrase was first started by southern Africans at the time of 17th century. People usually use it now when they see something that they thought was impossible, has been done. Or sometimes it can be used in a manner of not agreeing to something, in case of apologizing etc.
I'll be darned if I say sorry to him.
He finished the game on hard difficulty? I'll be darned.