Basing it off this link: http://gogen-allguide.com/hi/hiniku
It originates from Buddhism, from the teachings of Bodhidharma (an influential monk of Zen Buddhism who lived during the 5th or 6th century). It is a contraction of 皮肉骨髄, with 骨 meaning bone and 髄 meaning bone marrow. When the Dharma was teaching his disciples, he would variously say to them 'you have received my skin' or 'you have received my bones', and if he told his disciple that he had received his bones or marrow, that would mean that he had understood the deeper underlying meaning of his teachings, whereas if he told his disciple that he had received his skin or meat, that would mean that the Dharma was criticising his disciple for having taken his teachings at face value, and that he had not understood the essence of his teachings.
Fast forward to the modern day and 皮肉 now just means to criticise spitefully, hence the meaning of 'sarcasm'. I don't know how you get from sarcasm to irony, but that's probably at the border of philosophy or logic which I understand nothing about.
Great question by the way, I always find it fascinating to explore the etymology of words.
Skin + meat = Irony? Does someone have an explanation?
Looks obscure to me. Can't seem to find an explanation to the meaning.