A Pokemon that can mega evolve must be holding it's respective stone to mega evolve, and transformed Pokemon can NOT mega evolve even if they are holding the stone.
But this scenario can take place,
a Pokemon can transform into an already mega evolved Pokemon by transforming into the opposing Pokemon but some abilities can not be copied. eg: Parental Bond can not be copied so a ditto that has mega evolved to mega kanga can not hit twice.
Hope I helped:)