We prove that a compact symplectic or cosymplectic foliation on a cosymplectic manifold is stable. This result extends to the odd-dimensional case the corresponding one for symplectic foliations on symplectic manifolds. A large family of examples is given.