Buy some wire...coil it round a pencil of the desired thickness till you have the right length...cut wire...slide off...stick on top of fence/wall/whatever.
That would be the cheapest and easiest.
If you want to take it a bit further and make it have spikes then you can take the idea above then stick some wee spikes on.
Or maybe, I'm not sure if this would work, coil 2 pieces of wire round each other, to make kind of a rope. Perhaps with one piece of wire being slightly thiner than the other.
Then with this "rope" of wire coil it round the pencil like with above. Now the bit I'm not sure about. Take some clippers and carefully cut one of the pieces of wire (the thinner if you have 2 different thicknesses) then bend the cut piece out to form the barb/razor. Perhaps add a little superglue behind the bent part then move down the wire and make anther clip, and bend those bits up...repeat down the length of the wire.
Hope that makes sense, it's just an idea that popped into my head as I was typing the really basic no barbs version.
Also you could do it by taking a tiny piece of some really thin wire making a loop with it then sliding it onto the main piece...my first idea would be faster (easier to production line) but having individual spikes might look more realistic.
Then at the opposite end of the scale to "getting some wire and coiling it" you have the various brass/metal packs of barbed/razor wire...minimum effort maximum price tag on those.