Henin said she had not fully recovered after falling ill following her win at the Porsche Grand Prix in Stuttgart last weekend, her first title since coming out of retirement.
"Madrid has been a difficult experience this year and I hope that next year will be better," she said.
Sharapova battled back from a poor start to level the first set at 4-4 before Safarova took control by winning the last six games of the match.
"It's a struggle trying to find the rhythm," Sharapova said. "I thought she played really solid, good tennis and did everything she needed to win the match. More solid than me anyway."
Fourth-seeded Venus Williams beat Swiss qualifier Stefanie Voegele 6-4, 6-2.
On the men's side, ninth-seeded David Ferrer beat Jeremy Chardy 6-3, 7-6 (2). Ivo Karlovic topped Evgeny Korolev 6-4, 7-6 (5) to set up a second-round match with sixth-seeded Fernando Verdasco. Juan Monaco beat Simon Greul 6-1, 6-1.