We consider the preparation of matrix product states (MPS) on quantum devices via quantum circuits of local gates. We first prove that faithfully preparing translation-invariant normal MPS of N sites requires a circuit depth T=Ω(logN). We then introduce an algorithm based on the renormalization-group transformation to prepare normal MPS with an error ϵ in depth T=O(log(N/ϵ)), which is optimal. We also show that measurement and feedback leads to an exponential speedup of the algorithm, to T=O(loglog(N/ϵ)). Measurements also allow one to prepare arbitrary translation-invariant MPS, including long-range non-normal ones, in the same depth. Finally, the algorithm naturally extends to inhomogeneous MPS.