When I give burrowed units to another player, regardless if they both have the technology to burrow or not, the burrowed units always unburrow before burrowing again. Is there any way to prevent this from happening?
If you give to a computer it does that for some reason... (I have noticed that too).
If you give it to the computer and it does not have burrowed enabled, it won't reburrow though.
I do not think it is possable to prevent this. If you give it to a human it will work, but not to a cumputer.
Ok, now I'm getting a little ticked off. I switched it so that the units were removed and new burrowed units were created for the other player. The effect still sometimes happens! They unburrow and reburrow, whichshouldn't happen if I'm simply creating burrowed units.

Computer units will always unburrow, regardless of tech. Not sure of hero units though.
Are you sure, because most of the time they stay burrowed. As I said, only some of them unburrowed.
Not sure, but I've tried giving a lurker to a computer playing without the burrow tech and it would unburrow and burrow, even though it didn't have the tech. The hydra I tested with however, only unburrowed. I only tested it with those two. Is it unit specific or just randomly?
Have you read
this tute?
Lurkers override the "burrow" research status - they can always burrow and unburrow if burrowing is enabled, even if it is not researched.
Any computer unit can unburrow regardless of research status.
Idle military computer units like to burrow.
Try giving the burrowed unit to a main (p1-8) neutral player, or to p12, or maybe even to p9-11.
If removing + creating, maybe you are making units on top of each other, and they unburrow because of that?
Ya its all good now.

I switched the player I was giving the burrowed units to, which was a computer, to a neutral player. It fixed the problem. Which is a great help for me.
Strange thing is that I read that tutorial, but I guess I didn't read close enough.
I tested it too.
Units only seem to unburrow when given to a computer player.
Giving a burrowed unit to a human player, a neutral main player, player 12, players 9 to 11, or to a main player who is not in the game will not cause it to unburrow.
Creating many burrowed units at the same place stacks them on top of each other. They will not automatically unburrow unprovoked.
I'm glad you got it to work.