Cane here refers to 'punish someone or hit someone with an object made out of cane'
It can be a stick made of cane or something else.
'to cane' is a verb.
'to be caned' is a passive voice form of 'to cane'.
In the old days, slaves were beat using things made of natural resources like cane, bamboo, wood, etc.
That's where it comes from.