Sure. A mortgage is a contractual obligation between you and a bank. You don’t need to be a citizen of the U.S., at least, to buy a house…and I suppose it would depend on the laws of each country, but I can’t imagine any country preventing you from filing for any immigration status in that country because of debt obligations in another country – or because of any third party contracts.
What may be the case is that there could be limitations in your mortgage that may view such moves as a default, or may require further assurances. Therefore, I would look at your mortgage agreement more than immigration laws.
And note that nothing would prevent you, most likely, from applying. But if you’re going to be applying for immigration, it’s advisable to speak to an immigration attorney regardless.