In future, make sure kitty gets plenty of water to drink, and if you've been feeding him all dry food, you might want to add 1/2 can of wet food a day for starters, with the goal of eventually getting him on a mostly canned food diet.
At his age, he's also venturing into the times when male cats sometimes start developing upper and lower urinary tract problems, and liquids will help in staving that off. I give my chronically constipated 18+ YO cat strained baby food squash as a supplement; he loves it and it helps keep his stools a bit softer.
Plain canned pumpkin is also loaded with the fiber cats need for moving waste along the colon.
There is also a possibility that he's straining to urinate, which is also very serious. Blockage can cause cause toxins in the blood which are potentially fatal.
Off to the vet with your fuzzy guy, and good luck!