The small scales associated with lab-on-a-chip technologies lend themselves well to capillarity-dominated phenomena. We demonstrate a new capillarity-dominated system where two adjoining ferrofluid droplets can behave as an electronically-controlled oscillator or switch by an appropriate balance of magnetic, capillary, and inertial forces. Their oscillatory motion can be exploited to displace a surrounding liquid (akin to an axial piston pump), forming electromagnetic "liquid pistons." Such ferrofluid pistons can pump a precise volume of liquid via finely tunable amplitudes (cf. pump stroke) or resonant frequencies (cf. pump speed) with no solid moving parts for long-term operation without wear in a small device. Furthermore, the rapid propagation of electromagnetic fields and the favorable scaling of capillary forces with size permit micron sized devices with very fast operating speeds (similar to kHz). The pumping dynamics and performance of these liquid pistons is explored, with experimental measurements showing good agreement with a spherical cap model. While these liquid pistons may find numerous applications in micro- and mesoscale fluidic devices (e. g., remotely activated drug delivery), here we demonstrate the use of these liquid pistons in capillarity-dominated systems for chip-level, fast-acting adaptive liquid lenses with nearly perfect spherical interfaces.