You need to go to your mortgage document is find the "owner occupancy affidavit". You signed this document to promise you will occupy the property for (usually) one year.
If the lender found out you did not fullfill your owner occupancy obligation, they can recall the mortgage.
Read the affidavit to find out if there are exceptions, such as change of job, family emergency etc.