Astronomers have a number of ways to measure the distance to stars.
In the case of supernova 1987A, an unusual method could be used. At an earlier stage in its life, the star which exploded emitted material which formed a ring. Light from the supernova eventually bounced off of this ring, and was seen here about a year after the supernova was seen. Now, imagine a triangle. We know one of the angles - the angle, from here, between the supernova and the ring.