Quantum simulation provides quantum systems under study with analogous controllable quantum systems and has wide applications from condensed-matter physics to high energy physics and to cosmology. The quantum system of a homogeneous and isotropic field in the Friedmann-Robertson-Walker universe can be simulated by a charge in an electrically modulated ion trap. The quantum states of these time-dependent oscillators are constructed by quantum invariants. Further, we propose simulation of quantum Friedmann-Robertson-Walker universe with a minimal massive scalar field by a charged scalar field in a homogeneous, time-dependent, magnetic field in quantum electrodynamics and investigate the Cauchy problem of how the wave functions evolve.