Navier-Stokes equation is a local equation - each quantity entering it is a function of position and time, e.g., $\rho\rightarrow\rho(\mathbf{x},t)$, and the equation relates quantities and their derivatives at each point $\mathbf{x}$. This is also for the force $\mathbf{f}\rightarrow\mathbf{f}(\mathbf{x},t)$, which is a body force, applied to every point in the liquid (although not necessarily the same for every point.)
On the other hand, a piston would perturbs only a layer at the boundary, which favors its inclusion as a boundary condition. What is problematic here (as pointed in the answer by @Carla) is that it does actually move through space, i.e., we cannot specify it as a condition at a fixed point, e.g., $x=x_0$.
One way of dealing with this is, as the other answer suggest, specifying a (varying in time) pressure gradient at this point - it is an approximate approach, but it is likely to work for many problems.
A more principled approach is to write the equation first in Lagrandian coordinates, where the points adjacent to the piston are either not moving or experience a collision against the boundary of the liquid (i.e., the piston), and then switch to the Eulerian coordinates (for which the equation in teh Q. is written.) This is apparrently a well-known approach, see, e.g.
The exterior non-stationary problem for the Navier-Stokes equations in regions with moving boundaries
MOVING BOUNDARY PROBLEMS
(Admittedly, the first links that came up in Google.)