Considering that sound can't travel through vacuum.
In one of the many, many shows that covered scientific inadequecies in Star Wars, it was explained that because the engines used ions, and space is not truly empty, the sound was transmitted through the little gas that was there. I guess this could explain why few ships actually used thrusters to change attitude in space also. Weak, but it was all they could come up with.
The canon novel Lords of the Sith makes explicit the fact that characters in-universe cannot hear explosions in the vacuum of space. For example, on page 16:
[Vader's] interceptor streaked toward the gun bubble, aimed directly at it. Content with the trajectory, he unstrapped himself, overrode the interceptor’s safeties, threw open the cockpit hatch, and ejected into space.
Immediately he was spinning in the zero-g, the ship and stars alternating positions with rapidity. Yet he kept his mental hold on the air-lock handle, and his armor, sealed and pressurized, sustained him in the vacuum. The respirator was loud in his ears.
His ship slammed into the gun bubble and the transport, the inability of the vacuum to transmit sound causing the collision to occur in eerie silence. Fire flared for a moment, but only a moment before the vacuum extinguished it.
We therefore have to interpret the sounds we hear in the films as an out-of-universe artifact (i.e. as observers, we can hear the sound of a ship exploding as if we were inside the ship itself).
If you're looking for some kind of excuse try claiming that the explosions are hot enough to create plasma and you are listening to a unfiltered radio receiver.
It's not a great explanation---the details aren't right---but for something to hang suspension of disbelief on, it'll do.
And it covers the guns, too, if they work on magnetohydrodynamic principles.
It was learned with 2001: A Space Odyssey (1968), released in 1968, that 100% pure space realism doesn't make for good sound design. It managed to be dramatic enough through its own silence, but that was part of the art of the film.
When audiences see an explosion, they expect to hear it. That's been our experience since birth; things that drop make a noise when they hit, and things that explode make a bang. This is so ingrained in us that many times even depictions of real explosions in documentary-type shows, filmed from a distance for safety, have the explosion part of the soundtrack brought up to match the blast. Otherwise, we'd think that they screwed up the sound-to-video matchup in post-production.
So, out-of-universe, most space sci-fi movies have put sounds in space; the Enterprise whooshing by, sounds of phasers, blasters, and torpedos heard in shots taken from an in-space POV, even the "puff" of thrusters firing in Apollo 13 (1995), which was very technically accurate in most other respects. Sometimes it can be explained that, although the POV is outside, we're listening to what someone inside the ship that we're looking at would hear reverberating from the hull of the ship through the inside atmosphere; that explains 99.9% of the sounds in Apollo 13. However, most of the Star Trek and Star Wars sound design simply cannot be backed up by real physics; it's simply more dramatic to engage both sight and sound in a movie, and when that movie is in a theater, even feel (as the shock wave of the sound reproduction of the explosion "hits" you, and low rumbles resonate in your seat).
I can think of only one of the "pop" sci-fi movies after 2001:A Space Odyssey where the silence of space was ever illustrated, and that's Star Trek (2009), where the woman is sucked out through a hull breach in the Kelvin into the vacuum in the initial scenes; the full perspective of the battle is right in front of you but I think even the explosions and phaser fire is cut out, leaving just a subdued music track for the shot of her floating away amidst debris from the Kelvin and weapons fire from both ships. Again, its sole purpose is not technical accuracy but rather drama; our rational mind expects silence in a vacuum, so we get a taste, and we suspend disbelief and are sucked into the universe of the movie, after which they can do whatever they want sound-wise (like the "light-speed boom" of a ship entering Warp).
Pablo Hidalgo (Head of the Lucasfilm's Star Wars Story Group) spoke to this in a recent tweet. In short, ships in the Star Wars universe don't travel through pure vacuum. They instead travel through a form of invisible matter called "ether".
Among other things, this explains how the audible compression waves that would be caused by an explosion in air can also be heard in space.
PH: If you need to, you could say the interstellar medium in Star Wars does have an ether, which would explain such pulpy things as sound, concussion rings, visible drag, and such odd tech callouts as "an etheric rudder" from Heir to the Empire. Only if you ⋆really⋆ need to, though.
Like if it helps you sleep at night and whatnot.
I heard JMS once say that an astrophysicist told him that you CAN hear explosions in space - just not the way they sound in movies. Specifically, if you have an explosion, part of the makeup of that explosion is something that will carry the sound waves (like oxygen). So when the (whatever) explodes, you'll "hear" it when the gases involved in the explosion reach you.
I was under the impression that, on some scenes, it was done properly.
For instance, when Fett was chasing Obi-Wan in the asteroid, the sound from the explosions had a delay. Which was the time required for the shockwave to reach the ship.
EDIT: When I said shockwave, I meant the shrapnel + gas + whatever was expanding in those explosions. Those would reach the ship and transmit the vibrations.
Depending on the distance to the explosion, that could produce a considerable amount of sound inside the cabin (which does have air), but not damaging the ship in any significant way.
It's set in a different galaxy with different physics, much more fantastical, where science of our universe has no sway.
According to George Lucas himself:
RS: You firmly establish that at the beginning of Star Wars with the words: “A long, long time ago in a galaxy far, far away…”
Lucas: Well, I had a real problem because I was afraid that science-fiction buffs and everybody would say things like, “You know there’s no sound in outer space”. I just wanted to forget science. That would take care of itself. Stanley Kubrick made the ultimate science-fiction movie and it is going to be very hard for somebody to come along and make a better movie, as far as I’m concerned. I didn’t want to make a 2001, I wanted to make a space fantasy that was more in the genre of Edgar Rice Burroughs; that whole other end of space fantasy that was there before science took it over in the Fifties. Once the atomic bomb came, everybody got into monsters and science and what would happen with this and what would happen with that. I think speculative fiction is very valid but they forgot the fairy tales and the dragons and Tolkien and all the real heroes. (Source)
I seem to recall somewhere - maybe in the A New Hope novelization - Han explaining that the sounds are added by the ship's computer, based on its sensor data, as a way to alert personnel (gunners in this case) about the position of ships without taking their eyes off the sights or needing a lot of interpretation.
So if your ship - say an X-Wing - picks up an exploding TIE fighter off on the left, it plays an appropriate sound, and you know that the TIE fighter on the left blew up without having to look at it. If it detects something coming up alongside you, it plays an appropriate engine noise. That sort of thing.
You can read sound optically: try Googling "laser microphone".
And anyway, the viewer is supposed to enjoy a godlike viewing experience, there nothing to say that the viewer is forced to live with the limitations of the human body and senses. As long as the characters don't hear the sounds, everything else is okay.
One might as well complain when we are treated to a swooping establishing aerial view of a historical battle, "But that's stupid, people wouldn't see that in real life, they didn't have helicopters in the Nineteenth Century!" Or think about indoor scenes when we follow characters from the side as they walk through doors, or where we see an interior view of a scene in a 10ft wide kitchen, with the camera 20ft away, because it's a set and the obstructing walls aren't there.
Imagine how upset physicists would be if they were presenting the latest computer-generated flythough of the structure of our galaxy, or a deep space survey of galaxy clusters spanning hundreds of millions of lightyears, if some "Sheldon" stood up in the audience and declared "You've got the physics all wrong! your observer is travelling at vastly more than the speed of light! This video shouldn't take five minutes it should take hundreds of years! It's been sped up! And where's the Doppler shifts? Fake!"