Ronaldo came on as a substitute to Italian international Antonio Cassano but was cautioned in the 82nd minute before collecting his second booking in the stoppage time.
The 30-year-old talisman appeared to have said something to the referee, prompting the second yellow card.
Getafe center back Alexis Ruano scored the winner on the hour mark when he towered at the far post to head a corner-kick past Real keeper Iker Casillas.
Real's first defeat of the season put them in fourth place with 11 points, two behind leaders Barcelona, who play Sevilla at home on Sunday. Getafe moved to eighth spot on 10 points.
The capital side will host arch-rivals and defending champions Barcelona in their next La Liga fixture on the 22nd of October.
Real coach Fabio Capello opted for a second-string defensive line, with Raul Bravo and Ivan Helguera starting while Italy captain and World Cup winner Fabio Cannavaro was benched.
Alvaro Mejia also started as a right-back due to the absence of Michel Salgado and Brazil's Cicinho through injuries.