Are professors required to perform research as a necessity to teaching?
Over the course of a long career in teaching, the nature of your instruction will necessarily need to change as both our scientific understanding of the world and our society change. This is especially true for undergraduate and graduate instruction, where the knowledge is more specialized and changes more quickly, but I would argue it is also true for much of one's earlier schooling as well.
To be a good instructor, then, I think that one absolutely must keep up with the evolving nature of one's field. But does that require doing research? I don't think so (except, of course, for advising graduate students who are required to do research). Remaining involved in research is definitely one of the easiest ways to keep up with a field, but it's not a panacea either: research is typically extremely focused and narrow, and being up to date in one's particular research sub-field does not necessarily mean you will learn about everything relevant to instructing your students in a course that is only related in the more general sense (e.g., a platinum electrocatalyst researcher teaching introductory organic chemistry). One can consume information about research without producing it oneself, however, and many other forms of professional education are also available.
Bottom line: doing research is a great way of keeping up with your field, but not necessarily sufficient and not necessarily the only way.
One of the primary differences between tertiary education and K-12 is producing knowledge. At the K-12 level, teachers share knowledge but normally do not create new knowledge. At the university level, professors do share knowledge but they also contribute to the conversation by producing original research. In other words, the growth of knowledge is one of the main purposes of higher education.
Different institutions have different expectations of research at the tertiary level. However, it is often considered unusual not to take part in some form of research occasionally at the university level, even if your primary occupation is teaching.
You may not necessarily need to do research to be a good teacher - but depending on where you go, getting a "permanent" position may have its own requirements of research. In the US at least tenure is usually tied to some level of research involvement, which ranges from "you need to be a top researcher" to "you need to get your name on a few minor things, but it's possibly less than you did for your masters", all the way to no research requirement (more typical in small liberal arts places, community/junior/tech colleges, etc). But lets say you got a position and you just want to be the best teacher possible.
To be the best teacher possible, the use of research may heavily depend on what exactly you teach. If you are teaching the first two years of typical math - college-level algebra, geometry, calculus, probability - as far as I'm aware that material has not, and likely will not, be changing from year to year and new research findings in those fields won't much change low level courses. Some of my favorite teachers in this area actually have told me they don't like research and that's a large part of why they sought out the opportunity to teach such classes, and I can't really imagine how having done research specifically enhanced their ability. Low level math classes are usually just so incredibly far from research that I can't see how experience in research would be indispensable.
On the other hand if you are teaching applied math in areas like data analysis, machine learning, statistics, etc - keeping up to date on the newest approaches and techniques would be extremely important to ensure your students are getting the education they'll need for their chosen field. Similarly if you are teaching just about any other high-level class, much of the material can be inspired or based on insights from research.
Finally, if your students might possibly want to seek involvement or even a career in research, not being actively involved in research can restrict your ability to help them down that path. If you will be asked or expected to advise independent study, or teach classes specific to things like research methods in your field, you may find your effectiveness impaired by your lack of experience and ongoing involvement in research.
If you don't fit into any of these special-cases, and the reality on-the-ground in your region/country allows you to be a teacher without research, then I don't think research will be strictly necessary for you. But for many people in many different regions, research is often a requirement to some extent - from a minor requirement to an absolute necessity.