Procainamide is a medication primarily used to treat and manage ventricular arrhythmias, which are irregular heartbeats originating from the ventricles of the heart. It belongs to a class of drugs known as antiarrhythmics, specifically a Class 1A agent, that works by blocking sodium channels and slowing cardiac conduction.