What the observer sees depends upon where the observer is, due to the finite speed of light.
For definiteness, assume the forward end of the pole is marked "A" and the after end is marked "B". Let's also assume there is a light source inside the barn, and that the pole stops moving as soon as end "B" is inside the barn.
- sequence of events
- 1. End "A" enters the barn and continues toward the back. 2. End "B" enters the barn and stops in front of the observer. 3. The door closes. 4. End "A" continues moving and penetrates the barn at the far end. 5. End "A" stops outside the barn.
- An observer at the other end of the barn will see
- 1. End "A" enters the barn. 2. End "A" passes the observer and penetrates the back of the barn. 3. If the pole has markings on it, the observer will notice the part nearest him has stopped moving. However, both ends are still moving. 4. End "A" stops moving outside the barn. 5. End "B" continues moving until it enters the barn and then stops. 6. The door closes.
After the observers have subtracted out the effects of the finite speed of light on what they see, both observers will agree on what happened: The pole entered the barn; the door closed so that the pole was completely contained within the barn; as the pole was being stopped it elongated and penetrated the back wall of the barn.
Things are different if you are riding along with the pole. The pole is never inside the barn since it won't fit. End A of the pole penetrates the rear wall of the barn before the door is closed.