And Wikipedia goes on to say this:
“After she was fired from The Fresh Prince of Bel-Air, Janet’s character was played by Daphne Reid for the remainder of the show’s run. According to Will Smith, the show’s star, he and Janet had difficulties working together long before her pregnancy.[2] Janet Hubert has accused Will Smith of being ruthless, destroying for all actors overshining him.”
Probably the producers wanted a way to get her out of their faces release her and used the pregnancy to do that.