Well, it totally depends on the circumstances whether your executable can be run on your new system or not. Each operating system defines it's own exectuable file format. For example, here's how windows exe's look like. There's a reason why they are called portable executable.
When your compiler generates such an executable, it does first compile your C code to the corresponding assembly of your target architecture and then packs it into the target executable file format. Static memory allocations find their place in that format.
You can imagine the exe file as sort of a memory image that is loaded into a new memory space by the operating systems process loader. The operating system maintains the offset to this location and makes sure all the programs memory access goes into it's process' protected address space.
To answer your specific question: Transferring an executable between systems of the same operating system and architecture is usually no problem. The scenario same OS but different machine architecture can usually be handled by the OS via emulation (e.g. Mac OS's Rosetta emulates PowerPC on x86). 64/32 bit compatibility is handled this way too. Transferring between different OS's is usually not possible (for native executables) but everything that works inside virtual machines (java vm, .net CLR) is no problem, as the process loader loads only the virtual machine and the actual program is run from there.