Having not read the GRRM books and going off of the television show and thus movies as comparison, the Rohirrim might be in trouble if they aren't already assembled. As per the book and movies, the Rohirrim are spread about so there might just be scattered bands of hundreds of cavalry running about so Theoden would have to muster the full force of the Rohirrim.
From the glimpse we got of the conflict in the movies, small Rohan towns don't seem to have much in the way of walls and Edoras, the Capitol has a tall wooden palisade it seems. I think the Khalassar, especially based on their onscreen performances like the Battle of the Golden Road and even Kings Landing as well as the various individual combats I think could prove pretty formidable warriors compared to the Rohirrim. And considering how I'm assuming the Rohirrim are scattered and unmobilized, and the Khalassar of Khal Drogo is probably starting off as a cohesive unit, I think Rohan is in for a really rough time.
A main highlight I think is Theodred was killed at the Fords of Isen by the Uruk-Hai in the films. According to the movies that's the only way to move a large army deeper into Rohan or whatever if they are say, coming through the Gap of Rohan. Assuming Theoden isn't infirm by evil magics, their best chance would be to defend that chokepoint. From the film Theodred and Eomer didn't seem to have more than a couple hundred troops combined, though they were professionals and the garrison at Edoras maybe three hundred more.
Five hundred against forty thousand even at a chokepoint doesn't sound like good odds, but they'll have to find a way to delay them so that their population can flee to Helms Deep... and even Edoras (it still has a fence after all) and hold out there, maybe while assembling a force in the East perhaps for a counterattack.
I would agree with an earlier comment that ten thousand Rohirrim could defeat forty thousand Dothraki, but it's far from a close thing. Dothraki are pretty tough combatants. But the Rohirrim meanwhile swept the fields at Pelennor. Their massed charge would crush the Dothraki and the latter actually seem like the type to stand and fight... to their disadvantage.
There also might not be a fight as the Khalassar apparently aren't all about taking cities for their silly reasons so while Rohan's lands might be devastated to a degree, as Theoden says, they can weather it out from their refuges.