Recent experiments have demonstrated that light can induce a transition from the quantum paraelectric to the ferroelectric phase of SrTiO3. Here, we investigate this terahertz field-induced ferroelectric phase transition by solving the time-dependent lattice Schrödinger equation based on first-principles calculations. We find that ferroelectricity originates from a light-induced mixing between ground and first excited lattice states in the quantum paraelectric phase. In agreement with the experimental findings, our study shows that the nonoscillatory second harmonic generation signal can be evidence of ferroelectricity in SrTiO3. We reveal the microscopic details of this exotic phase transition and highlight that this phenomenon is a unique behavior of the quantum paraelectric phase.