In the same vein as OP'S question, I recall reading a book that stated Egyptians slept on beds of stone, I'd dismissed the idea as pseudo-history (due to the source). What does history tell us about hard beds and pillows long long ago?
I wouldn't consider myself any sort of expert on this subject, but it's been 5 days so I'll give it a shot. Also, I'm going to limit this to within the context of Ming Dynasty China, even though ceramic/earthenware pillows probably existed in other times and places.
Also, I'll spoil the ending of this right now - this isn't going to exactly answer "why" they slept on the pillows or whether they were actually comfortable or not, but rather just provide more context into what role these pillows held/why they existed at all.
To start off, there doesn't seem to exist a lot of comprehensive and conclusive research on this subject, yet. Did Ming Chinese people actually sleep on porcelain pillows, and how frequently? Perhaps they were mostly just used while lounging but not for actual sleeping. Were they ever covered in cloth to soften them? If so, were they always used with cloth?
A lot of these questions we have partial answers to, but not conclusive ones. That being said, we do have more substantial knowledge of the broader context surrounding the Ming ceramic pillows that we can use to make better guesses, or at least narrow down the possibilities.
Thus, let's talk a bit about family/household structure in the Ming Dynasty. I don't want to get into a huge essay on it just for the sake of a few pillow deductions, but I'll build my way to the important points in bullet form. If you want to learn more, Di Wang's Study on Family Rules in the Ming and Qing Dynasties is a good short (but longer than this) and easy-to-read introduction to the topic of family rules and structure of this time period.
The stricter and more complex family structures/rules combined with the narrowed and lowered status of women resulted in a social custom of complete sequestering of women in these upper-class families (and to some extent in lower families, but they didn't have ceramic pillows so never mind them today). Family manors would be literally divided into a "women's area" and a "men's area". Visitors from the outside world would only ever enter the offices and similar spaces within the men's area, and the women of the household would only ever leave the women's area on particular occasions.
Of course there had to be some overlap - namely the bedroom. One known layout (though I don't know if this is representative of common practice or not) was where the "man of the house" had his bedroom accessible from the men's area (though outsiders would not be taken here, either), and each of his wives/concubines' private bedrooms connected to his bedroom through separate entrances.
Since women were confined to the women's area of the manor, the bedroom was often used for far more than just sleeping (it might help to think of the "bedroom" as more of an apartment for the wife within the home itself). Whether symbolically (since there were certainly other rooms within the women's area) or in practice, the bedroom was the room where a woman would read, compose poetry, play music, or other leisure activities. A Ming marriage amongst the wealthy could include a bed as part of the wife's dowry, and then feature the bed being paraded down the street as part of the wedding procession.
Given this symbolism and use of the bedroom, and given women's status and role in society, it might not surprise you then to learn that many of the parts of a woman's dowry were (a) furnishings for her bedroom, and (b) reinforcing/reminding her of her obligation to her husband.
Ceramic pillows were (often) both.
Ceramic pillows were (as far as we can tell) far more often owned by women, and their primary placement was in women's bedrooms. Many of the surviving pillows that have been discovered are shaped or painted in ways that are related to matrimonial obeisance, fulfilling one's family duty, happy marriages, or fertility, such as this pillow's romantic inscription or this pillow's illustration of Wang Zhaojun, a Han dynasty princess who didn't want to be married off by her parents but went along with it anyways.
This does not necessarily mean that ceramic pillows were never used by men. But so far, there have been many ceramic pillows with messages/illustrations which seem clearly intended for women, and even ceramic pillows in the shape of reclining women, while as of yet no pillows have been found with similar suggestions of male usage.
Even keeping things limited to women's usage, though, their specific usage is not yet fully understood. Were they used only while lounging or actually slept on? If actually used for sleeping on, how regularly? Were they covered in cloth or used in conjunction with other sorts of pillows/supports? We do know for sure that they were not just symbolic/decorative until used in the owner's tomb, as there are written accounts from those times referring to women using them (while alive). But that doesn't tell us anything about how comfortable they were or how exactly they were used.
As far as I know (and that's not worth much), there is not yet any authoritative conclusion to these questions. But I hope you can enjoy at least knowing more about why these possibly-very-uncomfortable ceramic pillows existed at all and some of the meaning behind them.