If you DO have to ship something, use a premium priced overnight package delivery service. Have it delivered to a place of accommodation ahead of you, where you already have a reservation.
Call the hostal or hotel, or message them in advance, to request permission to have a small parcel delivered. Tell them it contains a medical device that you need but forgot at home.
This has worked for me in the past. Just keep the package out of the respective country's postal systems. They are very good for domestic shipments, in the UK and Spain. But, shipments that cross national borders usually take more steps and time.
You can solve this problem with enough money thrown at it for a top-tier international package delivery service that offers "overnight" delivery.
The alternative, suggested by another respondent above, is to seek a Spanish dentist who can supply a generic retainer - if that is something that you can deal with.
Another, similar suggestion - if you can use a generic retainer - is to go into a pharmacist, explain your situation and ask their advice. My wife uses a custom, molded retainer. But, I have another friend who is able to use a generic, off the shelf retainer / bite guard.
Hope this helps.
Tom