Now the problem here is that we have 2 potential emergency situations. This is because what you are seeing fits with bloat but also urinary blockage. Therefore, you need to tread with great care here. And I have to say that if you don't know the last time he passed urine; then it would be prudent to get your vet out now. The reason is because urinary blockages are an absolute emergency for male goats and cannot be treated with home care (since they need to be unblocked before his bladder ruptures). So, if you have any suspicion that he is not passing urine or cannot pass urine; then we'd need him seen as quickly as possible.
Otherwise, if you suspect GI bloat, then there are some steps you can take to reduce gas build up (which will be stretching the stomach to cause pain). First, the ideal treatment would be to pass a stomach tube just now. If you have one on hand and are familiar with doing this, then you can do this at home. If you are unsure how to do so, then again would be better done by your local vet (since misplacing the tube into the lungs could be fatal). Be aware when you place the tube, you may need a mouth gag or you can thread a thick roll of duct tape over the tube and prevent him from biting through it. Once the tube is in the stomach it will allow the gas to escape and you can deflate the stomach. As well, we often will then treat by stomach tubing mineral oil (1-2 qts) to neutralize the bacteria causing the gas and prevent recurrence of gas build up. Or if you couldn't tube to give the oil, you can drench it instead.
Overall, these are the 2 main issues we'd be worried about with the signs you are seeing. Both will cause distension of their respective organ and that is what makes them so painful. So, this is an emergency situation. And we need to identify which is distended and treat that for him. Once the pressure is released, they often will be much more comfortable (though his vet can give injectable gut and kidney safe pain relief if need be), but it is a case of addressing that issue urgently to relieve this for them.
Please take care,