In some popular science fiction, in which time travel is possible, the Sun - or some other star - is said to make possible an unusual and perhaps even controlled method of backwards time travel. This usually involves the intersection between the massive energy or gravity well of the Sun and the peculiar characteristics of a faster-than-light technology such as a warp drive or a controlled artificial wormhole.
In particular, both Star Trek and Stargate involve supposed means of time travel involving the Sun. In the first, in what is referred to as a "slingshot effect" or a "light-speed breakaway" point, a ship travelling at extremely high velocities (using its warp drive) approaches the Sun and uses the Sun's gravity to accelerate it further; it then circles around the Sun and, as it heads away from the Sun, some sort of undescribed whiplash effect causes the spacecraft to travel back in time as well as away from the star. A similar procedure can then be used to travel forwards in time, as well.
The second scenario, that described in Stargate, is accidental and uncontrolled (although it should be noted that in Star Trek Sun-based time travel was performed both deliberately and unintentionally). In this case, the faster-than-light transit method in use is an artificial wormhole between defined points in space marked by circular rings, or "stargates," created and maintained by never-explained ancient technology. (One episode nevertheless implies that, with the proper understanding of advanced physics, an improvised stargate can also be constructed with commonly available twentieth-century technology.) The unexpected interaction of the wormhole path with a solar flare caused it to back-link to its own location at a point in the past, so that the would-be space travellers ended up travelling through two points in time, static in space, rather than two points in space, static in time. Whether a similar controlled effect could allow people to travel through space and time simultaneously is never explored in Stargate.
In both shows, the scientists involved do not bother to explain to the viewer precisely how the Sun's effects have made time travel possible. This is largely because there is no theoretical way this could possibly happen. Warp drives (like the Alcubierre drive) and artificial wormholes (like the Krasnikov Tube) have been defined on paper, and if they could be constructed in practice (which is not yet certain), they probably would not violate fundamental laws of physics. However, in neither case would this be affected by the Sun in any obvious way. At the very least, if the Sun's gravity or radiation did affect a faster-than-light drive, it would almost certainly be to draw a spacecraft off course or cause the technology to fail altogether, rather than to alter it so that it behaves in strange and unexpected ways.
The Star Trek "slingshot" maneuver, moreover, should be seen as a creative reinterpretation of a real-life orbital maneuver which is currently used to accelerate space probes: the gravitational slingshot. A slingshot maneuver can indeed be used to accelerate a spacecraft beyond the capacity of its own thrusters. However, this is not precisely because of the gravitational attraction during the approach (which is lost on exit), nor does it create any sort of known "whiplash" effect on the other side. Even if a real-life warp drive like the Alcubierre drive could be constructed, approaching and passing around a star would not alter the fact that it is a device for travelling through space, not a device for travelling through time.
Within the limits of the natural universe as understood by contemporary theoretical physics, time travel is theoretically possible. However, it is only of a limited sort - and only going forward. Forward and backward time travel could occur through wormholes, as envisioned by Star Trek, but at the moment it seems that a large artificial wormhole could never be stabilized and controlled long enough for transportation through it to be possible. An Alcubierre warp drive, moreover, is explicitly capable of preventing the apparent time distortion caused by acceleration to extremely high velocities.
The real method of time travel, therefore, is more limited and more realistic. According to well-known physicist Stephen Hawking, if we could build a spacecraft capable of accelerating to a speed just short of the speed of light, and then braking back to a halt again, we could use that ship to effectively "skip" forward in time, since as the spacecraft accelerates to such high speeds time onboard will slow down relative to the normal passage of time outside the ship. The Hawking time ship could thus leap forward through time, emerging at a point in the future even as time seemed to pass at a normal rate for those onboard. However, Hawking's ship could never go back in time to its origin point: all the crew could do would be to press even further into the future. And to do so, they would not need the Sun. To attain such enormously high speeds, one would need such a powerful propulsion source that the relatively modest gains in velocity which can be obtained through gravitational slingshots would be unnecessary.