It's a colorful idiom. I imagine the literal meaning is probably military. It refers to a a dangerous explosive that will detonate if not handled carefully.
"The people running the Long-Term Capital Management hedge fund should have realized that their 25:1 leveraged position could blow up in their face."
"The politician had been whipping his supporters to a frenzy by demonizing that minority group. But now he needed the votes of that veery minority group, and his strategy was about to blow up in his face."
And here is a literal example, a quotation from a novel. A man is using the dangerous and unstable explosive, nitroglycerin, to build a bomb. "If he let it get too hot, it would blow up in his face. If he did anything too fast, it would blow up in his face. If he jiggled it too hard, it would blow up in his face. Any little mistake at all, and Smoke would die right there in the hotel room."