I have done this more than once with no ill effect but you MUST let the unit stand upright for some time before you plug it in, even for a moment. I'm not sure what the recommended time is but I'd let it sit at least a day and preferably longer.
The reason is that the refrigerant (almost always a freon variant except on some really old stuff) changes state from a liquid to a gas as part of the normal refrigeration cycle. This is true of all compressor-type refrigerators and air conditioners and is the reason they can move heat from one location (the evaporator) to another (the condenser). However, liquid cannot be compressed so if some liquid refrigerant gets into the compressor the latter will be damaged. When upright the cooling system is designed to keep any liquid out of the part of the compressor that compresses gaseous refrigerant but once laid sideways all bets are off. When the unit sits upright the liquid will gradually return to where it is supposed to be.