Aiming at the formation and maintenance problem of UAVs in an obstacle environment, a distributed model predictive control (DMPC) algorithm with no reference trajectory considering system constraints is proposed. In order to deal with the constraint coupling and cost coupling existing in model predictive control (MPC), the assumed trajectory is introduced to design a low conservative compatibility constraint and a cost function of no reference trajectory, so that the algorithm can be executed in a distributed and synchronous manner. Secondly, the terminal constraint is designed based on the speed barrier method to ensure the safety of the terminal domain, and a feasible terminal control input is given. The cost function is taken as a Lyapunov function, combined with the constructed stability constraint, and the iterative feasibility and system stability of the algorithm are analyzed. In addition, in order to take into account the real-time performance, a non-strictly stable DMPC algorithm that can better meet the requirements of formation obstacle avoidance is given on the basis of the proposed algorithm. The effectiveness and superiority of the proposed algorithm are verified by numerical simulation.