So there are two things you do to take very long "exposures" like this for astrophotography:
1. You put the telescope on a motorized mount that rotates the telescope exactly counter to the rotation of the Earth (or I guess its orbit in the case of Hubble). This cancels out most of the blurry star trails you get from the Earth's rotation causing the stars to move across your frame.
2. For particularly long exposures, you take a series of separate photos (each of which is probably done using step 1). Then you "stack" those in software by aligning all of the images to maximize their sharpsness. There is software that will do this for you automatically. Stacking helps correct for thermal noise and other imperfections and non-linearities that photon sensors have when collecting for a really long time.
1. You put the telescope on a motorized mount that rotates the telescope exactly counter to the rotation of the Earth (or I guess its orbit in the case of Hubble). This cancels out most of the blurry star trails you get from the Earth's rotation causing the stars to move across your frame.
2. For particularly long exposures, you take a series of separate photos (each of which is probably done using step 1). Then you "stack" those in software by aligning all of the images to maximize their sharpsness. There is software that will do this for you automatically. Stacking helps correct for thermal noise and other imperfections and non-linearities that photon sensors have when collecting for a really long time.
It's a good question.