In general, there is no rule in English to tell you when to pronounce the 'h', but it is rarely silent. That seems to answer the superficial reading of your question. So you have to learn the exceptions as they come along. Usually they turn out to borrowings from French, like 'honest'
But your examples seem to be about 'th'. In general, in English, 'th' is almost always pronounced as a single sound, the lisping tongue-between-the-teeth hiss. So you have to learn the exceptions as they come along. For your two examples, they are both borrowings from foreign languages and spellings are decided on arbitrarily, sometimes based on the original spelling (as in the case of German) or by accepted correspondence between the writing of the original language and English (or sometimes someone just makes it up and it sticks).
Since the 'th' sound is rare in all the languages of the world, and English is one of the few with that sound, the rule of thumb for you would be, if reading English, if you see a 'th' spelling, if it looks non-English, it's probably pronounced like 't', but if it looks native English, it's probably the lisping sound.