The advent of x-ray free-electron lasers (XFELs), which provide intense ultrashort x-ray pulses, has brought a new way of creating and analyzing hot and warm dense plasmas in the laboratory. Because of the ultrashort pulse duration, the XFEL-produced plasma will be out of equilibrium at the beginning, and even the electronic subsystem may not reach thermal equilibrium while interacting with a femtosecond timescale pulse. In the dense plasma, the ionization potential depression (IPD) induced by the plasma environment plays a crucial role for understanding and modeling microscopic dynamical processes. However, all theoretical approaches for IPD have been based on local thermal equilibrium (LTE), and it has been controversial to use LTE IPD models for the nonthermal situation. In this work, we propose a non-LTE (NLTE) approach to calculate the IPD effect by combining a quantum-mechanical electronic-structure calculation and a classical molecular dynamics simulation. This hybrid approach enables us to investigate the time evolution of ionization potentials and IPDs during and after the interaction with XFEL pulses, without the limitation of the LTE assumption. In our NLTE approach, the transient IPD values are presented as distributions evolving with time, which cannot be captured by conventional LTE-based models. The time-integrated ionization potential values are in good agreement with benchmark experimental data on solid-density aluminum plasma and other theoretical predictions based on LTE. The present work is promising to provide critical insights into nonequilibrium dynamics of dense plasma formation and thermalization induced by XFEL pulses.