The ends of a wormhole could, in theory, be intra-universe (i.e. both exist in the same universe) or inter-universe (exist in different universes, and thus serve as a connecting passage between the two).
Wormholes are an extension of black hole physics, namely, what if that point of infinite density at the center of a black hole (the singularity) actually had a hole in it?
Einstein hypothesized that, according to his equations of general relativity, it was theoretically possible for black holes to bend space-time to such a degree that, for a brief moment, it could tear, creating a wormhole. If you could pass through that wormhole, you could travel from one distant part of space to another -- and possibly even travel through time (time travel). This gives rise to the speculation that such wormholes could be used to travel from one parallel universe to another. In string theory, a wormhole has been envisioned to connect two D-branes, where the mouths are attached to the branes and are connected by a flux tube.
These wormholes are also believed to be a part of space-time foam, a concept in quantum mechanics, devised by physicist John Wheeler, who in 1957 coined the phrase 'wormhole'.
The earliest known idea of wormholes was theorized in 1921 by a colleague of Albert Einstein, German mathematician Hermann Weyl in connection with his analysis of mass in terms of electromagnetic field energy. He was one of the first to conceive of combining general relativity with the laws of electromagnetism.