Guinea pigs are afflicted with seizures for many of the same reasons as humans. A few of the seizure causes can be controlled and prevented, while others are inevitable.
Guinea pigs infested with mites will sometimes suffer seizures as they continually scratch and gnaw at their skin. A veterinarian can supply a safe, effective topical ointment to treat them.
Some guinea pigs have a genetic predisposition to seizures. The only way to avoid this is to not breed an afflicted guinea pig.
Poisoning, usually in the form of exposure to lead-based products, such as the paint used on the cage, has been found in some guinea pigs. If the poisoning source is removed early enough, the guinea pig can usually be saved.
Brain tumors are very rare in guinea pigs, but they are not unknown and they do cause seizures. While surgery is available, the cost is prohibitive and most owners cannot afford it.
Epilepsy is also rare in guinea pigs but has been diagnosed. Usually a trauma to the head is the cause. Your veterinarian may prescribe anti-seizure medication, but it is difficult to get the correct dosage and even more difficult to administer.