If a tube was built between two planets that stretched and moved as they did (don't worry about how it connects to the planets) and if a set of rails was on the inside, could a rail based vehicle move through it without being crushed and have its passengers survive?
Yes. With the amount of handwavium required to create a tube like that, permitting travel within it would be a cakewalk. The material properties of such an stretchable material are far more difficult to achieve than those required for travel. A similar question might be "If a society could construct a space station like the ISS and keep six astronauts alive year after year without mishaps, would they be able to make toast up there?"
Depending on what your definition of "rail" is, you may need to invest heavily in expansion joints:
We use these on rail lines to handle the natural expansion and contraction of the metal rails due to temperature.
Possibly, but rail travel isn't a very good way of going between planets. If we say that ~1,000km/h is a reasonable speed for a high-speed train in a vacuum, then to go from Earth to Mars would take between six and seven years.
Much better - once in space - to use a rocket and take advantage of the friction-less environment.
Assuming your material has sufficiently high elasticity and strength at strain (which is a measure of the elongation of a material under pressure).
However, do consider that two planets, even those near each other can vary widely in distance. Consider that Venus can be anywhere from 38 to 261 million kilometers. The thickness of your rail will be significantly reduced when you stretch it. If the rail stretches by a factor of ~7 as the bridge to Venus would, then the rail itself will decrease in cross-section by the square root of that factor, or about 2.6. So you would need an engineering solution to ensure your 'vehicle' fits your tracks as they change size.
Why risk wrapping the rails around the sun by going to mars? Let's go to Alpha Centauri so the orbits of the planets are trivial when compared to the distance between.
Now stretching is a non issue. Just have that pesky speed of light to deal with