If a spousal or common-law application is being filed from within Canada, IRCC has given the liberty to a foreign spouse of changing a visitor application to work permit from within Canada. Such applications are approved generally within 4 months and the foreign national can live a normal life with health insurance, a social insurance number and a host of other social benefits until permanent residence is finally granted. During this transition phase from a visitor permit to a work permit holder, I definitely tell my clients not to leave Canada for risk of placing that change of status from within Canada in jeopardy. However, the question becomes whether the individual must remain in Canada for the full processing time of the permanent resident application. The issue is more pertinent for those coming from countries where you initially require a visa to enter Canada as opposed to visa-exempt countries.
If you come from a visa-exempt country and have a work permit in hand, there is no issue with you coming and going during the processing of the permanent resident application. However, if you do come from country from which Canada requires visas in the first instance, then it is imperative that you not leave Canada at all or at least apply for a multiple entry visa from within Canada before you leave Canada. To apply for a multiple entry visa (provided you have a new work permit), see the following site:
http://www.cic.gc.ca/english/visit/cpp-o-apply.asp
In short, with regards to leaving Canada. I do not recommend leaving during the first 4 to 5 months months while changing from a visitor to a work permit holder, but after that, it is quite permissible to come and go as is elaborated further at the following IRCC website :
http://www.cic.gc.ca/english/helpcentre/answer.asp?qnum=248&top=28