means that
resisting an unavoidable authority or force may prove futile and cause further harm to the person resisting. Pricks are the pointed goads used to drive animals.
Origin
The expression comes from the ox-goad, a pointed stick used to drive oxen. If an ox kicked against the sharp goad, it would only injure itself. Closest equivalents Don't fight a losing battle. Don't beat your head against a brick wall. You can't fight City Hall. (American idiom)
Imagine a case where to resist or rebel against a stronger force or an unavoidable reality, only to make your own situation worse; to struggle uselessly against…; then “To kick against the pricks” fits well.