Did Matt Damon lose weight to look that skinny in The Martian or was that a body double?
No. According to Bustle (The interview was a press Q&A on set):
"I talked to [Director] Ridley about [losing weight for The Martian] because I’ve lost weight before for movies," Damon told Newsweek. "We had about six months. And I said, 'That’s perfect. I’ll lose about 30 or 40 pounds, and we’ve got to shoot all that stuff first.'
And he went, 'Fuck that.'"
There was no information to if it was a body double, none was listed in the credits. The article above believes it was cgi and shows various examples.
As an example, Chris Evans in Captain America was also had a CGI based body that was even more extreme than Damon's, showing how advance and realistic the effects can be.