It's so you can create specialized away teams. Sometimes you may want a science officer wtih medical abilities only, or you may want one with AOE stuff. You may want and engineer with turret creation, you may want another with weapon jamming/holding.
Same with space. so you can swap out your BOFFS depending on your situation.
You can train up the other officers in ground combat and use them on Away Missions while your Primary BOs are used for Space combat. Also, you can train your officers to be more effective on different types of ships such as: Tactical BO #1 has High Torpedo Yield I (Science/Cruisers), Tactical BO #2 could have Rapid Cannon Fire (Escorts)
The extra BOs are useful if you want to say switch to a different ship within the same level range, or as you level. I keep a spare tactical officer promoted to the same level as my max Engineer BO so I can swap between escort and cruiser. My extra tac officer is mostly cannon and torpedo abilities, while my cruiser specific tac officer is there to support my beam broadside cruiser loadout.
Also, I have different BOs to give me different skills for utility in PvP, in case I feel I need different abilities at times (mainly my science officer).
And, as someone above said, for away team tweaking, but I haven't done that as much to be honest.
At Commander the Federation ship with the smallest crew complement is one of the escort classes at 100 crew. Obviously you can expect that you will have more than 4 officers to pick from when assigning personnel to duty stations or away teams. These are big military vessels, not small fishing boats.
Being a Klingon, I switch out my BOs depending on what skills I have them trained in and which ship I am flying, wether I am doing PvP or PvE....
Since I'm not a fan of the ground combat, the same could apply as stated before.
This also helped my to play around with different skills to find what works with what and what counters other things.
What Atoria said. For instance, when doing PvP you may want a sci bridge officer to have polarize hull and syphon. But in PvE sci team would be MUCH handier to take care of that messy viral matrix. This way you can train both sci officers in different paths and use them as the circumstances warrant.