Could someone explain which structure is correct and if it's okay to say the other one?
Oh, what have we here?
Oh, what do we have here?
Can we simply invert the subject and the verb to make a sentence interrogative as in French?
Neither is incorrect. The second is the more direct and obvious way to phrase the question. The first conjures perhaps a slight sense of antiquity or formality, because you would not expect to hear it in casual speech; it also has common literary use.