No, you don’t need to be nor resident, nor fiscal resident , nor applying for a VISA to buy a property in Portugal.
To make business in Portugal (buy properties, opening bank accounts and ask for mortgage loans, for example) you just need to have (or apply for ) a Portuguese Fiscal Number (NIF), and you are ready to start looking for properties.
In that case, you will buy a property (and eventually ask for a mortgage) as a non-resident for a secondary house.
You will pay higher transaction taxes, than if it was the principal house (only possible if you were resident) and, in case you need mortgage, banks will ask for a higher minimum downpayment (between 20% to 30%, depending on the bank and also on the country you are citizen from).
Nothing else is different from the rules and conditions a resident must fulfil to buy a property and ask for a mortgage loan.
And, if I apply for residence, does anything change?
In this case, you can buy a permanent (or primary) house, saving some money on transaction taxes – and also in property ownership taxes – but, if you need a mortgage loan, banks will define financing rules – namely maximum % of amount financed – not based where you live (or even your citizenship) but based on from where you receive your incomes.
In fact, if your incomes are not generated in Portugal, you will just have chances to apply for a maximum range of 70% – 80% of amount financed, depending on the bank and/or the country from where your incomes came (with or without exchange rate risk)
Basically, if your incomes are generated in Euro Zone, it is normal that you will apply for a maximum of 80%, if your incomes are generated outside Euro Zone, 70% of amount financed, would be your limit, knowing that banks can reduce maximum % of finance, to lower levels if your incomes are generated in countries with a higher exchange rate risk.