  We consider the three-dimensional Ising model in a $L_\perp \times
L_\parallel \times L_\parallel$ cuboid geometry with finite aspect ratio $\rho
= L_\perp/L_\parallel$ and periodic boundary conditions along all directions.
For this model the finite-size scaling functions of the excess free energy and
thermodynamic Casimir force are evaluated numerically by means of Monte Carlo
simulations. The Monte Carlo results compare well with recent field theoretical
results for the Ising universality class at temperatures above and slightly
below the bulk critical temperature $T_\mathrm{c}$. Furthermore, the excess
free energy and Casimir force scaling functions of the two-dimensional Ising
model are calculated exactly for arbitrary $\rho$ and compared to the
three-dimensional case. We give a general argument that the Casimir force
vanishes at the critical point for $\rho = 1$ and becomes repulsive in periodic
systems for $\rho > 1$.
