The only free and comprehensive online etymological dictionary of the Spanish language
hasta (Preposition) "until"
13th cent. Old Spanish fasta, ata, fata. From Arabic ḥattā 'id.'

Borrowing of prepositions is a rare phenomenon, and the variety of different written forms in Old Spanish is troublesome. To explain how the different written forms arose from Arabic, Ford (1911) distinguishes Old Spanish fasta from ata and fata. Ata and fata, Ford explains, are more conservative borrowings from Arabic ḥattā; later, an s intruded into fata to give us fasta. Between the three words fasta alone survived, and evolved into hasta.

But is an "intrusive s" a satisfying answer? Corriente's (1983) answer is that Old Spanish speakers also utilized the Latin phrase ad ista "to this" as a preposition, and it influenced the evolution of fata by transferring its -s-. For the continued etymologies of these words, see a and éste respectively.