Get Your Dog Care Questions Answered by Experts
It is possible that this was just a nightmare because when dogs dream, it can affect the whole body. However, if you noticed him urinating, defecating, excessively salivating or paddling like he was swimming, this can be a sign that he was having a seizure.
Surely, if you notice this behavior again, he needs to go to his regular veterinarian to be "worked up" for epilepsy. Epilepsy usually presents itself between 1-3 years of age. Your veterinarian would want to run some bloodwork to determine if there is anything happening in his body that would trigger the seizures. If there is nothing remarkable on the bloodwork, your veterinarian may or may not start medication.
Please note the length of each episode and how he responds after each one. Don't hesitate to call your regular veterinarian or emergency service if you have questions.