To improve the model accuracy and control efficiency for the movements of a virtual formation, this paper investigates distributed optimal control for the virtual formation control system in railways. Adopting the relative distance braking mode, a coupled optimal control problem with nonlinear train dynamics and constraints regarding collision avoidance and jerk is formulated for the virtual formation. To handle the non-convex constrained problem efficiently, a distributed augmented Lagrangian based alternating direction inexact newton (ALADIN) method under the model predictive control (MPC) framework is developed. For the execution of the distributed computational process, the copied variables are introduced to reformulate the original coupled problem in an objective separable form. By exploiting the problem separability, the ALADIN method decomposes the reformulation into a coordinated quadratic programming problem of small-scale and several local nonlinear programming problems that can be calculated in parallel, thereby facilitating real-time control and relieving communication burden. Numerical experiments on a metro line are carried out to verify the effectiveness of the proposed model and method. Experimental results demonstrate that high-performance tracking control for virtually coupled train units can be achieved in real time.