A 22-year-old Windsor man is going to jail for nearly two years for the "unprovoked" stabbing of a pregnant woman.

Court heard Benjamin Carter approached a woman he knew near a downtown bar on June 5, 2018. The pair hugged and then for some unknown reason, he stabbed her on the left side of her neck.

The 18-year-old woman was five months pregnant at the time. She survived, as did her child, but not without two major surgeries and eight days in the intensive care unit at the hospital.

On Friday, Justice Lloyd Dean sentenced Carter to two years less a day in jail for aggravated assault after Carter pleaded guilty to the charge in February.

Court heard Carter has a history of mental health issues and substance abuse problems from a young age.

Justice Dean said "being punished when you are ill is problematic.”

So while he wanted to sentence Carter to more than two years in prison, Justice Dean chose instead for a jail term of less than two years so he could also impose a three year probation term.

Carter’s lawyer Ken Marley says the term puts more responsibility on Carter to follow the law.

“He would be in custody for a portion of that two and a half years, he would then be on parole up to the end of that two and a half years but then that would be it,” said Marley. “So this actually maximizes the length of time that the probation officials can monitor his behaviour, after his release.”