Die Lösung hat der Lehrer.
Die Lösung hat der Lehrer. (The teacher has the solution/answer.) Is this more common than Der Lehrer hat die Lösung? Would the 2nd sentence: Der Lehrer hat die Lösung also be correct?
Der Lehrer hat die Lösung is more normal; however, Die Lösung hat der Lehrer isn't too uncommon - it is stressing that the teacher has the solution and not something else.
German can often put something at the beginning of a sentence to topicalise it -- so Die Lösung hat der Lehrer could be more explicitly translated as something like "Oh, the solution? Yeah, the teacher has that / It's the teacher who has that", i.e. it's a topic–comment sentence with die Lösung as the topic and hat der Lehrer as the comment.
So which order you use will depend on the emphasis or focus you want in your sentence.
Both word orders are grammatically correct.