No, Sam was already written out in the fourth season because Rob Lowe wanted more money and was upset that Sam wasn't the central focus of the show, which he was supposed to be before Martin Sheen was hired and stole the spotlight. In the show, the story was that Sam accidentally ran for congress, Will was drafted in to help Toby write the inauguration speech, the speech was so successful that Toby asked Leo to hire Will full-time in Sam's old job and if Sam lost the race for congress he could be promoted to the position of Senior Counsellor to the President. Sam's last appearance was with Toby in a bar as Toby informed Sam that he wasn't going to win the election but that they'll go down fighting the good fight, so more than likely he lost the election. This was only confirmed in season 7 when we learned that Sam was working in a law firm.
A similar thing happened with Ainsley Hayes, she had a big role in the second season, she was MIA for much of the third season but she turned up in an episode where it was announced she had been given a promotion and an actual office. She wasn't heard from until again season 7, but she was replaced with Joe Quincy towards the end of the fourth season.
A similar thing happened again with Charlie and Zoey's relationship, Charlie put her on the long finger after the shooting, but then he realises what an ass he is being and the two of them seem to make up. We didn't even know they had broken up until Zoey showed up with Frenchie in season 4.