Originally OE 'gif' — the initial g- eroded away in Middle English, from Proto-Germanic *jabai (if, when).
Introducing a conditional clause; on the condition or supposition that.
From Old English 'gif' (if, whether), from Proto-Germanic *jabai (if, when), of uncertain PIE origin. One hypothesis connects it to PIE *yebʰ- or relates it to the Proto-Germanic stem seen in 'give' (*gebaną), on the theory that a conditional is 'a given' — something granted for the sake of argument. The initial 'g-' was lost in Middle English, yielding modern 'if.' Gothic 'jabai' (if) and Old High German 'ibu/oba' (if) are the closest cognates. Key
'If' used to begin with a 'g.' Old English spelled it 'gif' — pronounced roughly like 'yif.' The initial consonant eroded during Middle English, leaving just 'if.' This is the same loss that turned Old English 'geolu' into 'yellow' in reverse — English has a complicated history with initial g/y sounds.