User mobility has a large effect on optimal content placement in device-to-device (D2D) caching networks. Since a typical user can communicate neighboring users who stay in the D2D communication area of the typical user, the optimal content placement should be changed according to the user mobility. Under consideration of randomness of incoming and outgoing users, we formulate an optimization problem to minimize the average data load of a BS. It is proved that minimization of the average data load of a BS can be transformed to maximization of a monotonic submodular function with a matroid constraint, for which a greedy algorithm can find near-optimal solutions. Moreover, when motions of neighboring users are rapid, the optimal content placement is derived in closed-form, aided by reasonable approximation and relaxation. In the high mobility regime, the optimal content placement is shown to cache partial amounts of the most popular contents.