We develop an accurate, highly efficient and scalable random batch Ewald (RBE) method to conduct 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 so the computational cost is reduced from $\mathcal{O}(N^2)$ to $\mathcal{O}(N)$ per time step. We implement the method in the LAMMPS 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 CPU efficiency of RBE.