Such fences are inexpensive to develop in regions where cacti are common, and can provide an extreme deterrent to any but a determined human intruder.
Often their primary function is to keep wandering large animals off a private property.
Prickly pears (mostly Opuntia stricta) were imported into Australia in the 19th century for use as a natural agricultural fence and to establish a cochineal dye industry, but quickly became a widespread weed.
Closely spaced columnar cacti such as Trichocereus or Mexican fencepost cactus can be used for more structured, space-saving fences.
[1][2] In the American southwest, ocotillo stems are often set in the ground to form a structure similar to a cactus fence.