In the American West, cattle could not be fenced in because there was not enough wood to make fences, and not enough labor to make stone fences. Cattle were raised on open range, and driven across many states from their home range to the rail heads in Kansas for transport to Eastern markets.
An improved barbed wire fence was made by 60 year old Joseph F. Glidden of Dekalb Illinois in 1873. His fence wire was made from two strands of smooth wire, with one wire encrusted with twisted barbs. The two wires were twisted together to secure the barbs, and the two wires proved sturdy enough to stop cattle from breaking the wires. This image from the Devils Rope Museum shows some of the hundreds of barbed wire designs that exist.
It is said that three inventions made settling the arid American West possible: the windmill, barbed wire, and the repeating rifle.
Glidden's design from his patent looks like the common type of barbed wire used today, more than 125 years later.