The expression 'what in tarnation?' comes from 'tarnal' meaning eternal and 'nation' meaning damnation. The phrase effectively translates to ‘What the hell?’