We study the Casimir effect in axion electrodynamics. A finite $theta$-term affects the energy dispersion relation of photon if $theta$ is time and/or space dependent. We focus on a special case with linearly inhomogeneous $theta$ along the $z$-axis. Then we demonstrate that the Casimir force between two parallel plates perpendicular to the $z$-axis can be either attractive or repulsive, dependent on the gradient of $theta$. We call this repulsive component in the Casimir force induced by inhomogeneous $theta$ the anomalous Casimir effect.