No-one really knows what the H stands for, if anything. And no-one has yet traced the origin of the expression.
It's possibly from the IHS symbol on crucifixes, which was commonly used as an abbreviation for Jhesu from the Middle Ages on, as was IHC. It's also possible that early users felt that inserting the H made the expression somehow less blasphemous.