The next verse (26:3) states that the reason was that God would bless him and give the land of Canaan to Yitshak and his descendants.
Rashi to Genesis (26:2) states that Yitshak was not supposed to leave Israel since he was [like] an unblemished olah offering. The idea seems to be that he was supposed to lead a particularly holy life that would preclude leaving Israel. Midrash Sekhel Tov (Buber) to Genesis (26:2) writes similarly.
In a similar vein, Midrash Maor HaAfelah to Genesis (26:1) states that it was not proper for him to leave Canaan since he was holy as he was conceived and born in Canaan.
Midrash Tanhuma (Buber) to Parashat Tol'dot (6) combines both of these ideas. He was not to leave Canaan since he like a pure olah offering, since he was conceived in Israel.
Radak to (26:2) explains that God was telling him to go to Erets Plishtim (which was not suffering from famine) as opposed to Egypt.
Verse 12 states that Yitshak reaped one hundredfold, so apparently with er the famine had ended, the famine didn't affect there, or God was helping him in particular.