Almost everything mentioned in the various comments here is a scapegoat. These all might contribute a little to the escalating prices at the margins, but they are not the root cause.
The root cause is that many capitalist societies have decided that purchasing a house is the most expensive and important investment most people will make in their lifetime. Therefore these societies gradually shape their policies to ensuring these investments continue to increase or else there are widespread repercussions. The end result is we have collectively refused to build enough housing to keep prices stable or decreasing. The prices need to go up. I don't understand why no one is willing to admit this.
All the other problems originate from this. The reason foreigners want to buy homes as speculation or a place to park their money is because governments are committed to ensuring that housing is a safe and profitable investment. It all comes back to us deciding that a basic human need should also be an investment that always is increasing in value.