The same thing happened to my dog a couple of years ago and the vet said it was probably heat exhaustion + sand ingestion. I didn't know this before (and I am so careful about it now), but when your dog plays fetch on the beach they actually pick up and ingest a lot of sand. Plus on that day I didn't have an umbrella so he was under the hot sun all day. Thankfully he's fine now, but I still kick myself for not being careful enough. It could've been much worse. Anyway, best thing to do is to take your dog to the vet. He may give him some fluids or pills to help settle his stomach. Good luck!