As you can see on the map above (c. 1200), Castille was only one of many kingdoms in Iberia. Often each kingdom or state having its own language. Castilian had the most influence in the Christian kingdoms of the north fighting the Moors but there were also the Portuguese, Leonese, Aragonese, Catalan, and the Asturian languages which are all also romance languages and closely related– but distinct from Castilian (Spanish).
However, by the time the Moors had arrived in the Iberian peninsula in the 8th century, there were already descendants of Latin-speaking peoples in the area. The Moors, when they arrived, simply called the range of closely-related vulgar Latin dialects as “Latin”. As one might expect, Moorish administration officially used Arabic for all governing purposes. Typically, only Muslims or those involved with the government would be able speak Arabic. Today this is known as Andalusian Arabic and it only truly died out in the 1600s with the final expulsion of Moorish Christian converts who kept Arabic as their main language.
What most people in Islamic Spain used as a lingua franca was based on what the original Christian population already spoke: vulgar Latin. The dialects of vulgar Latin in Spain were grouped together by the Moors into a romance language known as Mozarabic. Mozarabic wasn’t exactly a singlular language but a group of dialects and in addition to that, it was informal speech and not frequently written down. When it was written, it would usually be written in Arabic script but it was also sometimes written in the Latin alphabet or even in the Hebrew script which goes to show you how versatile this romance language was for the religiously diverse population of Islamic Spain. If you’d like to listen to what it probably sounded like, here is a video example:
Overall, Mozarabic was the lingua franca of Moorish Spain while administrative language was Arabic/Andalusian Arabic. When the Christian kingdoms gained more territory, Mozarabic would tend to gradually blend in with Spanish or other languages of the Christian kingdoms until the end of the Reconquista when it was fully assimilated into Spanish.