The Kibble-Zurek mechanism describes the formation of topological defects in systems crossing a continuous symmetry-breaking phase transition at a finite quench rate. While this mechanism has been extensively studied for equilibrium transitions, its applicability to nonequilibrium transitions has not yet been fully examined. Recent simulation has shown the applicability of the Kibble-Zurek mechanism to dynamical ordering transitions in particlelike assemblies, including superconducting vortices, driven over random disorder. Here, we experimentally study the configurational order of vortices in the course of dynamical ordering with various quench rates. We verify a power-law scaling of the defect density with the quench rate and an impulse-adiabatic crossover on the ordered side of the transition, which are key predictions of the Kibble-Zurek mechanism. Our results suggest the applicability of the Kibble-Zurek mechanism to other nonequilibrium phase transitions.