Several factors can cause an arrhythmia, including underlying heart disease, electrolyte imbalances, stress, excessive caffeine or alcohol intake, and certain medications. In some cases, it might be due to genetic conditions or congenital heart defects.