Members of SG1 are shown to carry a H&K MP5 as their primary weapon in the earlier series/seasons. At some point, they replace that with an FN P-90.
Was it ever explained why?
There is a specific episode when the characters change weapons, and it is explained why they do so. The episode where the switch was made is called The First Ones, which is season 4 episode 8. After Daniel gets kidnapped by an Unas, and after the rest of SG-1 figures out that it was an Unas who kidnapped him, they return to Stargate command. Once there, they inform General Hammond that an Unas had taken Daniel, and Jack recommended that they go back with P90s.
Turns out that they work pretty well against bad guys, so from then on the team has used them.
That is obvious.
FN P-90 has more stopping power and a higher rate of fire than a H&K MP5! It is also marginally lighter and has a higher effective range. If you are Special Ops what do you go for??
Portability, Stopping power, rate of fire. You don't want to get too encumbered, you want the things you are shooting to stay dead and you want to put so much hurt downrange that enemies get suppressed when you fire at them.
A simple Wiki search will tell you all you need to know about these 2 guns.
Never explained why, although if they had any kind of advisor he/she would tell to switch. Especially if the Director/producer is looking for a more cool looking gun.
No, a rationale for the change in weaponry is not discussed at any point in the script of any episode. (Hard to provide a reference for a counterfactual, so you'll have to trust my having watched each episode too many times.)
As mentioned above, Jack does discuss the benefits of projectile weapons (specifically the P90) over staff weapons when giving them to the rebel Jaffa, but there's never a discussion of P90 vs. other Earth weapons.
On a side note, over the years SG1 hired several combat veterans as consultants specifically to improve the realism of their combat scenes. That's why SG teams are always seen firing in short bursts (even with full-auto weapons) and why the actors often yell to each other during pauses in firefights (because in reality they'd be deaf). Notice how when they're in Zat/staff fights, they don't yell to each other very much.
The hypothetical in-universe explanations that I've heard which seem to hold water are
1) The unavailability of their older weapons owing to the start of the Iraq/Afghanistan wars. (It's well established in universe that those wars were taking place)
2) The older weapons were simply being phased out of service for newer ones, and as maintenence parts were harder to find, well, that sort of thing does happen in militaries fairly regularly.
That said, neither of these answers are canon.
There was also a point in which the base had upgraded all the monitors on base from CRTs to LCDs, and yet there was no in-universe explanation for that either.
Hardware upgrades happen on a regular basis because they happen in the real world too. And they happen for the same reason: newer, better equipment comes along. It's not a particularly interesting thing to spend time on, and it doesn't add to the story.