For a general two-body bound state in quantum mechanics, both in the stable and decaying cases, I establish a way to extract its two-body wave function in momentum space from the scattering amplitude of the constituent two particles. For this purpose, I first show that the two-body wave function of the bound state corresponds to the residue of the off-shell scattering amplitude at the bound state pole. Then, I examine my scheme to extract the two-body wave function from the scattering amplitude in several schematic models. As a result, the two-body wave function from the Lippmann-Schwinger equation coincides with that from the Schrödinger equation for an energy-independent interaction. Of special interest is that the two-body wave function from the scattering amplitude is automatically scaled; the norm of the two-body wave function, to which I refer as the compositeness, is unity for an energy-independent interaction, while the compositeness deviates from unity for an energy-dependent interaction, which can be interpreted to implement missing-channel contributions. I also discuss general properties of the two-body wave function and compositeness for bound states with the schematic models.