To investigate the microscopic change law of particle and water flow in the process of the vertical deformation of sand caused by withdrawing and recharging water, a PFC (particle flow code) program was developed to simulate the process of the water withdrawal and recharging of dense sand sample. The water flow was controlled by setting the boundary conditions. The subsidence and rebound of the sand sample, the velocity and displacement fields of particles, and the velocity field of fluid cells were analysed. It is indicated that the sand sample becomes dense and the settlement of the sand sample increases in the process of drainage. The settlement of all particles tends to be stable after a period of time. Particles move randomly at the beginning and subsequently downward. The movement direction of fluid is at random initially as well, and the fluid velocity at the inlet and outlet is greater. In the process of recharging the sand sample rebounds, particles move at random at the beginning and subsequently upward. The fluid cell also moves upward with the increase of fluid velocity. The research study is helpful in understanding the mechanism of ground subsidence from a microscopic point of view and reasonably exploiting and recharging groundwater.