To take long exposure photos of space the Hubble Space Telescope using a Fine Guidance System (FGS) that lock onto star guides that allow it to counteract it’s movement with gyroscopes. Having said that when the telescope locks onto a bad star guide (like a binary star or double star) the results are quite interesting:
via [European Space Agency]