We develop an accurate, highly efficient, and scalable random batch Ewald (RBE) method to conduct molecular dynamics simulations in the isothermal-isobaric ensemble (the NPT ensemble) for charged particles in a periodic box. After discretizing the Langevin equations of motion derived using suitable Lagrangians, the RBE method builds the mini-batch strategy into the Fourier space in the Ewald summation for the pressure and forces such that the computational cost is reduced to O(N) per time step. We implement the method in the Large-scale Atomic/Molecular Massively Parallel Simulator package and report accurate simulation results for both dynamical quantities and statistics for equilibrium for typical systems including all-atom bulk water and a semi-isotropic membrane system. Numerical simulations on massive supercomputing cluster are also performed to show promising central processing unit efficiency of the RBE.