Just an idea from a non-mathemagician, so forgive me is this answer looks naive to you.
I believe this story is referring to
But the same idea could apply to rational vs irrational numbers, it's hard to choose.
In a great world of numbers
Heard some people cry, I dunno why.
They lost a lot
Mainly the biggest ones
This alludes to the square root operation which, by approximately halving the number of digits of (the integer part of) its operand, has a greater impact on big numbers.
But a lot of them
Got into a new world
This may refer to the creation of imaginary numbers. This new set ("world") of numbers contains the result of applying the square root operator to negative numbers.
They were first imprisoned
"imprisoned" because they were confined into a named category
Then the confused mathemagicians gave them a funny name
They were very ashamed
Wikipedia tells us that imaginary numbers were "originally coined in the 17th century by René Descartes as a derogatory term and regarded as fictitious or useless"
Until... Some mathemagicians released them from jail... and, at last, they were free
The creation of complex numbers (by Abraham de Moivre, Leonhard Euler or Caspar Wessel, I'm unsure whom to choose). Consequently, imaginary numbers became part of a bigger group and were reunited with real numbers.
But they were weirdos for everyone except their breed
The mathemagicians were confused...
And people feel the same to this day!
Complex numbers may be difficult to comprehend and this category took a long time to be commonly accepted.