When your stomach feels hard when you press on it the cause could be something as simple as overeating or consuming too many carbonated drinks.
If the hardness of your stomach goes away within a day or so then it's usually nothing serious but if the stomach continues to feel hard when you press on it after a few days then it could be caused by something more serious which requires a medical diagnoses.
You could also have irritable bowel syndrome or inflammatory bowel disease which would require a medical diagnoses.
So I would recommend seeing a doctor if your stomach continues to feel hard.
Sometimes my stomach will feel hard when I have gas buildup in my stomach or when I have overeaten so it can be caused by something as simple as that or it could be a medical condition.