Some h-words need 'an' for the indefinite article (I will be there in an hour).
Other h-words need 'a' for the indefinite article (It is a history of sadness).
Is there a general rule?
If the "h" is pronounced, use "a". If it is silent, use "an".
This is in keeping with the general rule, which is to use "an" for words beginning with a vowel sound.
If a word begins with a vowel sound, then the indefinite article to use is an. If a word begins with a consonant sound, then the indefinite article to use is a.
There is a singular exception: If a word begins with an H sound and the first syllable of the word is unstressed, then you can use either an or a. Traditional rules says you must use an, but there is so much ignorance of this exception that you will find a is much more common in this case. For example, in the Corpus of Contemporary American English, there are 1956 incidences of a historical but only 415 incidences of an historical. However, using an here is also unimpeachably correct.
With some words it has to do with the French connection. The French don't pronounce hard 'H's. So words like Herbal are pronounced 'erbal, leading to a glottal stop if 'a' is used. That's why historically words like hospital and hotel have used 'an'. Written English would therefore use 'an'. In spoken English it depends entirely on whether or not you pronounce the 'H'.