The first paper to read is "Metric spaces and positive definite functions" by Schoenberg. (I first learned about this from Igor Rivin many years ago.) It follows from his main result + Corollary 1 that a (say, finite) metric space $(M,d)$ embeds isometrically in a Hilbert space if and only if the "distance matrix" of $(M,d)$ is conditionally negative definite. (Schoenberg first proves it for the matrix of square distances, but then Corollary 1 allows to get rid of squares.)
One can ask the same question about other spaces, like the separable infinite-dimensional real-hyperbolic space. In this setting, there are 4-point conditions on the matrix of distances (coming from negative curvature); but these conditions are insufficient and the problem is open. On the other hand, if one asks for an isometric embedding in the "universal metric tree" of Dyubina/Erschler and Polterovich, then the necessary and sufficient condition is known: It is equivalent to $0$-hyperbolicity of $(M,d)$, which is a combination of triangle inequalities and some 4-point conditions on the distance matrix.
On yet another hand, if one relaxes isometric to quasi-isometric embeddings but considers maps to real-hyperbolic spaces, then the problem was solved (for domains which are "reasonable" Gromov-hyperbolic spaces) by a deep theorem of M.Bonk and O.Schramm in the paper "Embeddings of Gromov hyperbolic spaces".
Lastly, I proved some time ago a general theorem about metric matrix for geodesic metric spaces $(M,d)$: Every triple of distances (subject to triangle inequalities) is realized by a geodesic triangle in $(M,d)$ if and only if $M$ is not quasi-isometric to point, half-line and the line. See here. This settles the question in the case $n=3$ for a reasonable class of metric spaces $(M,d)$.