One of the prime objectives of an operating system is provides a standard interface for the user's processes to use the non-standard functionality served by the varied hardware of different machines.
A primary peice of hardware on the machine is the "Central Processor Unit" or CPU and the code that it executes is called machine code or machine language. Each type of processor has its own machine language. An Intel processor has a different machine language from an ARM processor.
To overcome this problem a number of standard high level languages have been written. Programmers can write programs in one of these standard languages like C, Fortran or Ada, then another program called a compiler is used to translate the high level program into the machine language for the particular processor.
A new compiler has to be written to compile from each standard language to each processor's machine language.
(There are compilers that use intermediate languages i.e. compile from multiple standard languages into one intermediate language then to multiple machine languages. Thus every time you add a new standard language you benefit from getting it compiled for all the machine languages.)
So programs writen in standard languages can run on machines with different processors provided you have the compilers.