While it sounds like it might be of French or Spanish origin, there's no definitive evidence to support this. It first appeared in English in the early 17th century, and its etymology remains a mystery.
Some theories suggest it might be a corruption of "rascal" or "rascallion", or even a combination of "rap" and "scallion" (a type of onion). However, none of these theories are widely accepted.