This is theoretically/technically possible using scripts.
You can modify weapon graphics using scripts, you can also modify weapon damage and create some special effects etc.
I'd suggest taking inspiration from memmaker's Vigilo Confido to see how it can be done, using also the Soldier Skills feature (to activate the transformation).
As for actually physically transforming battleItem X into battleItem Y during battlescape... that's a can of worms I don't want to open.