Peter Kirby of ChristianOrigins.com had the following informative and amusing answer to the question. It has been edited slightly for readability.
Question: What is the origin of the H. in the phrase, Jesus H. Christ? There is no great mind which has not but come to rest on this important question. It is a question which every man must consider in the course of his education, and the answers discovered are as varied as the approaches taken.
The child brought up in a home of prayer, on first hearing the expletive from his father's lips, need only look to the words of the Our Father for the explanation: "Our Father, Who Art in Heaven, Harold Be Thy Name."
A student of biology, in contemplating the holy mystery of the Virgin Birth in the light of reason, will inevitably conclude that the H. stands for none other than Haploid, a distinction conferred only upon God's Son of all men, that He would not have the taint of Original Sin.
The theologian will undoubtedly be familiar with "IHS," which stands for the Latin phrase "Jesus Hominum Salvator," which means Jesus, Savior of Man. Note that the J is only a few centuries old and this trigraph is frequently found in medieval and Renaissance art.
A historian may be familiar with the tale that, before an important battle in 312, the Emperor Constantine saw vision of the cross in the sky and heard a voice saying that he would conquer "under this standard" or "in this sign." The Latin words would be "in hoc signo," which abbreviates to IHS.
The Greek scholar will look to the Greek letters for Jesus: "iota eta sigma omicron upsilon sigma," which is variously transliterated IHSOYS or IHCOYC, the latter when converted to Latin letters using the common curved sigma variant. If one takes the first three letters as initials, it is not difficult to derive "Jesus H. Christ."
The Judaic scholar can supply the reason for taking the first three letters. This is the practice of using standard abbreviations for sacred names, or nomina sacra, accompanied by a horizontal line as a warning that the words cannot be pronounced as written. The two most common forms are abbreviation by suspension (which is to use the first two letters) and abbreviation by contraction (which is to use the first and last letters).
A scholar of manuscripts noted that such abbreviations in early Christian fragments take the form IS, IH, or IHS when writing the Greek name Jesus. This would provide the basis for clever Latin writers later to make this sacred abbreviation of the name Jesus into a three letter acronym, a sort of pun, including "In Hoc Signo" and "Jesus Hominum Salvator."
The earliest writer to speculate on the initials of Jesus is the author of the 2nd century "Epistle of Barnabas" (9:6-7). In Lightfoot's translation, "Learn therefore, children of love, concerning all things abundantly, that Abraham, who first appointed circumcision, looked forward in the spirit unto Jesus, when he circumcised having received the ordinances of three letters. For the scripture saith; And Abraham circumcised of his household eighteen males and three hundred. What then was the knowledge given unto him? Understand ye that He saith the eighteen first, and then after an interval three hundred. In the eighteen 'I' stands for ten, 'H' for eight. Here thou hast JESUS (IHSOYS). And because the cross in the 'T' was to have grace, He saith also three hundred. So He revealeth Jesus in the two letters, and in the remaining one the cross."
A man who has wondered about the origin of the sacred middle initial, who has traced the etymological thread back to its ancient spool, and who has detailed the findings of his serious inquiry, may take a moment to reflect upon the nature of the question, a question that he has expended great efforts to understand.
Jesus H. Christ!
Circumspectful meta-pondering produces ineffable epiphany. Now that we have an answer, the question is, why did we ask the question? What is it that makes a man concerned to know the details of a matter so trivial, so irrelevant so as to seem beneath the briefest consideration? I am not sure that I know the answer to this question. But at least now I know that I am not the only one who suffers from acute curiosity, for, indeed, you have read it all to the end.