The Supreme Court discussed this issue in R v. Pham. The court discussed the ability of sentencing courts to consider what they referred to as collateral consequences as part of sentencing, and, for an offender, the immigration consequence of a sentence is considered a collateral consequence, just like how the impacts on a person's employment may be considered a collateral consequence as part of the sentencing stage in the criminal justice system.
The courts have been clear that sentencing courts can consider collateral consequences, like immigration consequences, but only insofar as that consideration doesn't change what would otherwise be a fit sentence. If a court concludes that a fit sentence is three years, and they take into consideration the immigration consequences, for example, and they say, “I'm taking those into consideration, and I'm going to, instead, impose 18 months imprisonment”, that would be inappropriate and inconsistent with the guidance of the court. However, if it is a difference of a week, a couple of days, when it's still within a range of proportionate sentences, that is something the courts have said is permissible.
