It's very archaic narrative technique preceding romance and novelistic forms. Two known examples from Greek literature are Euhemerus' Sacred History and Iambulus’ Islands of the Sun. Their utopian islands are apparently modeled from mythological Fortunate Isles.
Lucian's True History parodizes the whole genre of imaginary voyage, and in his foreword Lucian cites Iambulus as one of objects of parody. Photius states though in his Bibliotheca that its main object was Antonius Diogenes' The incredible wonders beyond Thule, a genre blending of fantastic voyage and Greek romance which popularized Pythagorean teachings.
The first to revive this form in the Modern era was Thomas More in his Utopia (1515), to be followed a century later by proliferation of utopian islands: Johannes Valentinus Andreae's Reipublicae Christianopolitanae descriptio (1619), Tommaso Campanella's The City of the Sun (1623), Francis Bacon's The New Atlantis (1627), Jacob Bidermann's Utopia (1640), Denis Veiras' The history of the Sevarambi (1675), Gabriel de Foigny's La Terre australe connue (1676), Gabriel Daniel's Voyage du monde de Descartes (1690), François Lefebvre's Relation du voyage de l’isle d’Eutopie (1711), as well as many others.
Lucian's satirical line was exploited by François Rabelais' Gargantua and Pantagruel (1532) and developed later on in Joseph Hall's Mundus alter et idem (1607), François Hédelin's Histoire du temps (1654), Cyrano de Bergerac's Histoire comique contenant les États et Empires de la Lune (1657) and Fragments d’histoire comique contenant les États et Empires du Soleil (1662), Charles Sorel's Nouvelle Découverte du Royaume de Frisquemore (1662), Margaret Cavendish's Blazing World (1666), Joshua Barnes' Gerania (1675), Bernard de Fontenelle's Relation de l’île de Bornéo (1686), Daniel Defoe's The Consolidator (1705), and most notably in Jonathan Swift's Gulliver's Travels (1726).
Imaginary voyage has become a natural medium for promoting new astronomic ideas. First literary space flights after Lucian were: Juan Maldonado's Somnium (1541), Johann Kepler's Somnium (1634), Francis Godwin's The Man in the Moone (1638), John Wilkins' The Discovery of a World in the Moone (1638), Athanasius Kircher's Itinerarium extaticum (1656), David Russen's Iter lunare (1703), Diego de Torres Villarroel's Viaje fantástico (1723), Eberhard Kindermann's Die geischwinde Reise auf dem Luftschiff nach der obern Welt (1744) - the first flight to planets, Robert Paltock's The life and adventures of Peter Wilkins (1751), Voltaire's Micromégas (1752).