Recall that the 1492 re-conquest of the Iberian peninsula by Ferdinand and Isabella didn't happen overnight.
In many areas Muslims had been living under Catholic rule for generations already, and were called Mudejars.
But tolerance was a limited commodity then, as now, and a decade after the reconquista Isabella proclaimed a much tougher stance towards the >500K Muslims who hadn't already fled or converted.
Proclaimed in Sevilla on 12 Feb 1502, Isabella decided to impose a conversion-or-expulsion decree against the Muslims.
According to the edict, all Muslim males aged 14 or more, or females aged 12 or more, should convert or leave by the end of April 1502. Slaves were excluded in order to respect the rights of their owners. Church officials argued that it was for their own good.
Leaving was not a real option -- Portugal had outlawed Islam in 1497, and the edict nixed moving to Valencia or Catalunya, with a lot more fine print in the order--because the authorities really wanted everyone to convert. Those who went through the motions but continued practicing Islam at home were called Moriscos and became kindling and fodder for the Inquisition. (the Jewish parallel were the Marranos.)
As Castile spread over the other kingdoms in Iberia in the following decades, things just got even worse.
https://en.wikipedia.org/wiki/Forced_conversions_of_Muslims_in_Spain