In season 2 of TNG, Dr. Crusher was replaced with Dr. Pulaski. In season 3, Dr Crusher came back. The best information I can find is "On Star Trek TNG, why was Crusher replaced by Pulaski? And...?" on Yahoo Answers. But there must be better more complete information out there.
In universe, she was the head of Starfleet Medical.
From "The Child":
WESLEY: It's going to be hard leaving the Enterprise.
PICARD: Mixed feelings for all of us. It's always difficult leaving any ship, just as it was for your mother when she left to become head of Starfleet Medical.
When she returned, not a lot was said, but in "Evolution" it's implied that she may have returned because it was difficult to be separated from Wesley:
PICARD: If you're concerned about Wesley, I see no evidence that there's a problem.
BEVERLY: I know. In a funny kind of way...that's exactly my point. We talk. We smile. It's almost too polite.
PICARD: Beverly, this is simply a matter of time. I know how difficult it was to be away.
BEVERLY (vulnerable): Tell me about him.
Out-of-universe, then-head writer Maurice Hurley didn't like her.
According to some recent reports, there was some sort of problem between Gates McFadden and producer/writer Maurice Hurley. I've heard this characterized in some places as sexual harassment, but I'm not sure that's based on any actual allegations. Rick Berman did say he was at the center of it, though:
Gates McFadden fired at end of first season because head writer Maurice Hurley "he had a real bone to pick" with Gates and din’t [sic] like her acting, Berman brought Gates back for 3rd season after Hurley left
(That quote is from the summary here.)
This comment also cites her hair (of all things) as costing lots of time and money to keep styled right to avoid continuity problems. Not sure I buy it, but there it is.
According to comments on the Season 2 Blu Ray, Gates McFadden was very vocal about the tendency of the scripts to run sexist in the first season, which created tension between her and the writers and producers. Patrick Stewart, on at least one occasion, stood up for her and added his voice to the complain leading a script to be largely changed.
With Hollywood largely STILL being a "boys club", especially behind the scenes, it's not hard to imagine how she would be fired for speaking up in such a fashion, which is seriously disappointing. ESPECIALLY concerning "Star Trek".
According to Memory Alpha, Crusher was written off the show due to difficulties that the writers were having with her:
Officially, the difficulties in developing Crusher's character led to her character's departure by the second season. Unlike Natasha Yar, however, the TNG writing staff reassigned Crusher to Starfleet Medical, leaving open the possibility for her return. The writing staff's dissatisfaction with the Pulaski character, fan pressure via a letter-writing campaign, and support from Patrick Stewart allowed this to happen during the third season.
This quote also says it was due to the staff not liking Pulaski, and both the fans and Patrick Stewart wanted Crusher back on the show.
She was fired
According to her page on Memory Alpha, she wanted to pursue other directions in her career.
As per Memory Alpha:
McFadden left the series at the end of the first season and was replaced by Diana Muldaur as Doctor Katherine Pulaski in the second season. An official announcement states, that McFadden had left the series to pursue other career options. McFadden herself got a call from her agent who told her that the producers decided to go in another direction with the character. Like the other cast members, McFadden was surprised. ("Gates McFadden - Dr. Beverly Crusher", The Official Star Trek: The Next Generation Magazine Vol. 12, p. 43)
Interestingly enough though, that's not what Wikipedia has to say:
At the end of the first season, McFadden was fired and replaced by actress Diana Muldaur as the Enterprise's Chief Medical Officer.
This excerpt references the following section from an interview with director Rick Berman:
Gates McFadden fired at end of first season because head writer Maurice Hurley "he had a real bone to pick" with Gates and din’t like her acting, Berman brought Gates back for 3rd season after Hurley left
As for her return:
But thanks to a letter-writing campaign, support from Patrick Stewart, and a personal invitation from Rick Berman, McFadden was brought back to the TNG cast for the third and subsequent seasons. McFadden was absent for all episodes of the second season and only appeared in stock footage in "Shades of Gray" which was used from the first season episodes "Symbiosis" and "Skin of Evil".
Apparently, there was disappointment that Hurley didn't live up to expectations:
Muldaur's character, Dr. Katherine Pulaski, didn't make it to the third season. Roddenberry described Muldaur as "a most talented actress", and said that the decision "to let her go was made solely because the hoped-for chemistry between her and the rest of the starship cast did not develop."
And, just to clarify the in-universe reason, Crusher was offered a position as the head of Starfleet Medical according to Memory Alpha.
What I remember from back then, but she was written off because she simply couldn't act. She filed a union grievance, and basically got lucky that the fans hated Pulaski and they needed a solution. All the rest of the "sexist" script stuff was nonsense. To this day, most of the cast still dont support her.