This is how the rescue is described in the book:
All six of them looked around. Professor Umbridge was lying in a bed opposite them, gazing up at the ceiling. Dumbledore had strode alone into the forest to rescue her from the centaurs. How he had done it — how he had emerged from the trees supporting Professor Umbridge without so much as a scratch on him — nobody knew, and Umbridge was certainly not telling. Since she had returned to the castle she had not, as far as any of them knew, uttered a single word. Nobody really knew what was wrong with her either. Her usually neat mousy hair was very untidy and there were bits of twig and leaf in it, but otherwise she seemed to be quite unscathed.
This merely tells us that Dumbledore rescued her, but does not tell us why he rescued her. However, based on the character of Dumbledore throughout the series, it seems likely that he did so out of his personal sense of morality. Dumbledore was known for merciful tactics, even against Death Eaters:
"Master of death, Harry, master of Death! Was I better, ultimately, than Voldemort?"
"Of course you were," said Harry. "Of course – how can you ask that? You never killed if you could avoid it!"
And:
“— attacking because they haven’t handed you over, yeah,” said Aberforth, “I’m not deaf, the whole of Hogsmeade heard him. And it never occurred to any of you to keep a few Slytherins hostage? There are kids of Death Eaters you’ve just sent to safety. Wouldn’t it have been a bit smarter to keep ’em here?”
“It wouldn’t stop Voldemort,” said Harry, “and your brother would never have done it.”
While not saving someone may not be equivalent to actually killing them, we have Dumbledore's own words discussing such a situation back in Prisoner of Azkaban:
“But —” Harry looked at him, aghast. How could Dumbledore take this so calmly? “But — I stopped Sirius and Professor Lupin from killing Pettigrew! That makes it my fault if Voldemort comes back!”
“It does not,” said Dumbledore quietly. “Hasn’t your experience with the Time-Turner taught you anything, Harry? The consequences of our actions are always so complicated, so diverse, that predicting the future is a very difficult business indeed.... Professor Trelawney, bless her, is living proof of that.... You did a very noble thing, in saving Pettigrew’s life.”
“But if he helps Voldemort back to power — !”
“Pettigrew owes his life to you. You have sent Voldemort a deputy who is in your debt. When one wizard saves another wizard’s life, it creates a certain bond between them... and I’m much mistaken if Voldemort wants his servant in the debt of Harry Potter.”
“I don’t want a bond with Pettigrew!” said Harry. “He betrayed my parents!”
“This is magic at its deepest, its most impenetrable, Harry. But trust me... the time may come when you will be very glad you saved Pettigrew’s life.”
Harry couldn’t imagine when that would be. Dumbledore looked as though he knew what Harry was thinking.
“I knew your father very well, both at Hogwarts and later, Harry,” he said gently. “He would have saved Pettigrew too, I am sure of it.”
It would seem quite reasonable that Dumbledore would consider saving Umbridge to be the "right thing", and would thus do it even if it meant potentially endangering himself (though honestly, being Dumbledore, there probably wasn't really much danger involved.) And Dumbledore is on record previously about choosing between what is right and what is easy:
“Remember Cedric. Remember, if the time should come when you have to make a choice between what is right and what is easy, remember what happened to a boy who was good, and kind, and brave, because he strayed across the path of Lord Voldemort. Remember Cedric Diggory.”
Finally, in this particular case, there may be something even beyond Dumbledore's basic sense of rightness at play. Umbridge was a teacher at Hogwarts. As Headmaster, Dumbledore is ultimately responsible for the safety of all residents, whether he personally approves of them or not, or whether they foolishly got themselves into trouble or not. This may, in fact, be alluded to in the conversation with Slughorn when recruiting him for a position the very next school term:
“If you’re going to tell me my life would be more peaceful at that pestilential school, you can save your breath, Albus! I might have been in hiding, but some funny rumors have reached me since Dolores Umbridge left! If that’s how you treat teachers these days —”