The main thing happening here is a shift in the meaning of terms. Specifically, the word "realist" has had many many different uses over time. The basic idea is that a realist believes something is real, i.e. that such entities do in fact exist, that they are metaphysical objects in their own right (rather than existing as modalities on the mind).
Realism when used in reference to mathematical realism and Plato is that X is believes Y do in fact exist.
So Plato is a realist about Platonic Forms. Mathematical realists believe numbers do in fact exist.
Plato's view stands in contrast to Aristotle's view -- which while also realist with respect to forms does not think the forms exist as ideas. Instead, they exist as essences in substances. In contemporary language, this is the debate over universals. Anti-realist views think that these things only exist in our heads as words or concepts. (Realist views can of course accept that we also make words or terms for these things).
The term idealism doesn't generally occur in this debate. Idealism instead refers to views where things only exist due to the mind. It's a partial offshoot of rationalism generally associated with Schopenhauer. Hegel is often called an idealist as well, but I would argue this is a misnomer.