The most general result ensuring the decomposition of a manifold is the following (see R.A. Blumenthal and J.J. Hebda. Ehresmann connection for foliations, Indiana Math. J. 33 (1984), 597-612):
Theorem: Let M be a simply connected manifold furnished with a foliation. If it admits an integrable Ehresmann connection, then M is diffeomorphic to the product of two leaves and the foliations are identified with the canonical foliations of the product.
Observe that no metric is assumed in the above theorem.
The classical result is the De Rham decomposition theorem: Let M be a complete and simply connected manifold Riemannian manifold. If M is reducible, then it split as a direct product manifold $M_1\times M_2$.
A wide generalization were obtained by N. Koike (Totally umbilic foliations and decomposition theorems,
Saitama Math. J. 8 (1990), 1-18)
Theorem: Let M be a simply connected semi-Riemannian manifold and $(F_1, F_2)$ two complementary, orthogonal and umbilic foliations. If the leaves of $F_1$ are complete and $dim F_1 \geq 3$, then M is isometric to a doubly twisted product of two leaves.
An also see R. Ponge and H. Reckziegel, Twisted product in pseudo-Riemannian
geometry, Geom. Dedicata 49 (1993), 15-25, were it is proven the following.
Theorem: Let $M$ be a simply connected semi-Riemannian manifold with $(F_1, F_2)$ two orthogonal and complementary foliations. Suppose that $F_1$ is geodesic and with complete leaves.
1. If $F_2$ is umbilic then M is isometric to a twisted product.
2. If $F_2$ is spheric then M is isometric to a warped product.
3. If $F_2$ is geodesic then M is isometric to a direct product.
As you can see, completeness and simply connectedness are always assumed, although they are not necessary conditions. In the paper M. Gutierrez and B.Olea, Semi-Riemann manifold with a doubly warped structure, Rev. Mat. Iberoam. 28 (2012), no. 1, 1–24, some decomposition results are given without assuming the simply connectedness hypothesis.
If you are interested in decomposition with a one-dimensional factor, you can see the following papers:
Y. Tashiro, Complete Riemannian manifolds and some vector fields, Trans. Amer. Math. Soc. 117 (1965) 251–275.
M. Kanai, On a differential equation characterizing a Riemannian
structure of a manifold, Tokyo J. Math. 6 (1983), 143-151.
E. Garc ́ıa-R ́ıo and D. N. Kupeli, Singularity versus splitting theorems
for stably causal spacetimes, Ann. Global Anal. Geom. 14 (1996), 301-
T. Sakai, On Riemannian manifolds admitting a function whose gradient is of constant norm, Kodai Math. J. 19 (1996), 39-51.
M. Gutierrez, B. Olea, Global decomposition of a Lorentzian manifold as a generalized Robertson–Walker space, Differential Geom. Appl. 27 (2009) 146–156.