https://maldita.es/malditateexplica/20221026/datos-okupacion... has the actual data (in Spanish):
* 10-17k cases of occupation annually (rising until 2021, but down in 2022 and further down in 2023: https://www.cronista.com/espana/actualidad-es/adios-okupas-c...)
* Of those ~15k, 5% are actually occupation of somebody's residence (allanamiento de morada) and 95% of cases are occupation of an empty and unused house/shop/office (usurpación de vivienda). That includes unused commercial properties, and homes that are neither rented nor used by the owner.
* Note that a personally used holiday homes are also considered as a person's residence, so any occupation there would also come into that first 5%: https://www.ocu.org/fincas-y-casas/gestion/gestion-patrimoni....
That is to say: it is a problem (the 500 - 1000 cases per year nationwide of occupation of people's homes is clearly problematic) but it's not a really widespread problem for most middle-class people (the vast majority of people even in the middle classes do not own totally unused property).
It is a significant concern if you're a commercial landlord with any shops & offices between rental contracts, or if you're directly investing in property as pure speculation, without using it at all (which imo should be discouraged regardless - although I'd rather punitively tax it).
In the really problematic 5% case of people's homes, my understanding is that the law has tightened significantly, and if you can show that you're registered as actually living there, in theory they will evict okupas within 24 hours (I don't know how well that works in practice though).