Traditionally, a compactification of a topological space is a compact space together with an embedding as a dense subspace. In some cases, the terminology ‘compactification’ is applied to certain cases where is not an embedding (does not map homeomorphically to its image equipped with the subspace topology), particularly in the case of Stone-Čech compactification of general topological spaces.
If the space has further geometric structure, the compactification is usually required to has such a structure and embedding has to preserve it. Many moduli spaces in algebraic and differential geometry have their natural compactifications. They are often useful because they carry natural integration which is useful in defining various invariants. Examples of compactifications in geometry: wonderful compactification? and Deligne-Mumford compactification?.
A useful intuition throughout is that a ‘compactification’ is a process of adding “ideal points at infinity” in some way to “complete” a space. (Compact regular spaces themselves being “complete” in a technical sense: there is a unique uniform structure whose uniform topology is the topology on , and is complete with respect to this uniformity.)
Often s space can be viewed as a total space of a bundle over some base. We may want to embed the space into a bigger bundle, such that the induced embedding of each fiber into the new fiber is a compactification.
This is roughly the case in most compactifications in physics. In most cases the space is equipped with a metric and additional quantities for defining physics, like Lagrangean density, which possibly depend on metric. Then one requires that the compactified fiber is finite but small compared to some reference scale (or even viewed in a limit when the Riemannian volume tends to zero), see Kaluza-Klein mechanism. Sometimes one does not even consider a noncompact case to start with but by compactification in physics means only passing to the limit of small (Riemannian volume of) fibers.