It's s deterrent. Very common in Latin America. Most crime is opportunistic and thieves can be in and out well before police or private security arrive. Justice can be hard to come by and police could even look the other way if they are in in it with bribes or in bed with organized crime.
It is shocking at first to see razor wire, electric fences, perimeter sensors, shards of glass embedded at the top of concrete block walls.
In the US you don't know if that house you are targeting has someone inside waiting with a gun. That is shocking to many outside cultures too.