In the original Lost in Space pilot (which, by the way, is well worth seeing to show what the show could have been), there is no Robot and Dr. Smith is not present. I've heard and read that the network requested changes, which resulted in the addition of Jonathan Harris as Dr. Smith as well as the Robot.
I know a plot device was used where the Robinson's went on a trip without Dr. Smith or the Robot so producers could use the footage from the original pilot in several episodes.
From what I've heard, the intent was to use Doctor Smith in the beginning as a reason for the Jupiter II to go off course and have to make a forced landing. This was the reason Jonathan Harris was listed as "Special Guest Star" on the credits. The intent was, after several episodes, to write him out of the show. While I've heard less about this, I've heard June Lockhart mention it in interviews, so I think it's valid.
The other part I've heard, and I'm not sure how accurate this is, is that Jonathan Harris intentionally modified his performance to make Dr. Smith less of a threat and more of an endearing goof-up so he would become more popular and it would be harder for the producers to remove him. I understand this played in with the producers' plans to make the show more camp and colorful to compete with Batman on another network.
So instead of Dr. Smith being written out of the script, Jonathan Harris remained for the full run of the show, listed as "Special Guest Star" for the entire time.
While I know most of the above is verified and there are some points I'm not sure of, the one thing I've never heard or found was if there was a plan in place for writing the character out of the show. Did any of the cast or crew ever mention that at any point?