If research is related to teaching then research could have a direct contributions to teaching. However, if research is not directly related to teaching, then how can each of them contribute to the other?
Personally, I struggle coming up with good teaching materials (lecture notes, homework questions, et cetera). I had lots of teachers that were either way too abstract where abstraction wasn't necessary, or gave really wacky examples that didn't have much basis in real life, and I silently vowed not to do that to my own students. One way that I've found to present real-life and relevant material is to draw upon my research. For example, if I'm lecturing about a particular biological system that I study, I might walk the class through a particular experiment that I ran to test an aspect of the system. I find that students feel these lectures are the most interesting, and they seem to grasp the material better than if I gave a "standard" lecture.
On the flip side, I always get 1-2 questions per semester where I don't know the answer, and it turns out no one else in my field does either. As such, the questions I get while teaching are a source of research questions that I may attempt to answer. If I actually think the question can be answered, I almost always invite the student or students who posed the question to help me with the research, which is also another way teaching impacts research (i.e., I expose more people to what research is, and I get help doing it).