There is an american franchise called
Holiday Gym which has some gyms in Madrid.
The problem is that they are expensive, they make you pay a year in advance, and are usually quite crowded.
Probably your best choice is to install yourself first in Madrid and then ask your neighbours where is the nearest gym.
Fernando