I want to learn Emacs or Vi. I don't like modal editing but Vi is ubiquitous and looks more useful for emergencies. What are the reasons why Emacs is not preinstalled in most distributions?
The direct answer is probably that
vi is part of the POSIX standard (as @jasonwryan also mentioned in a comment), as well as the Single UNIX Specification. As such, anything that calls itself POSIX-compliant probably includes something
vi-like, and anything that wants to call itself UNIX has to, or you don't get certified. Not just
vi, but the related line editor
ex and the scripting language involved are also part of these standards.
emacs is not part of the standard, so it is not included.
As for why this is so, there are several reasons. For one,
emacs is far, far bigger and more complicated than
vi. There's a whole LISP in there, among other things. The part of POSIX that decides this was written in 1992, when you would need a very beefy computer for
emacs. I've seen a
vi run on Minix on a 286 semi-decently. And while it doesn't really matter all that much for a modern desktop, on embedded systems it still very much does. Its size and versatility also makes it harder to check it for security holes, which might be an issue in certain applications where security is imperative. Basically, everything that might make it a better desktop application makes it a worse system component.
If you're up for a history lesson, you could also say that
vi is closer to the Unix philosophy: do one thing and do it well. Indeed,
vi sprang from
ex, and has always been an Unix program.
emacs sprang from a vastly different world: it was originally built on top of TECO, written for the ITS operating system. It was only ported to Unix in the 1980s, as ITS was dying out. This makes
emacs in effect an immigrant from a very different culture, while
vi is a native.
vi first came out in 1976, so it's not just that
vi is older.
This is not how it works.
The choice of packages installed by default is typically driven by practical needs. There is no single practical reason to add particularly emacs into a default installation, unless you are installing a distribution specifically focused on emacs users, if there is anything like that at all.
A typical linux distribution by default installs a minimal system plus what the userbase is expected to use (very often a graphical desktop, firefox, libreoffice and a couple of tools). If emacs is not part of the minimal system, it doesn't make sense to have it in the default installation.
A minimal system is there to allow a power user (administrator) to run the system, perform basic configuration tasks using the command line, and install whatever he wants.
There is certainly need for a text editor in such a minimal system, as you may need to edit configuration files. A good minimal candidate is nano as it's both easy to use and very small in footprint, therefore you will find it in minimal systems of most distributions nowadays. Another good candidate is a simple implementation of vi because, as others mentioned, it's the standard editor on POSIX systems. That is why minimal systems typically contain those two, sometimes only one of them.
An entirely wrong choice would be emacs which is not minimal, not easy to use as nano and not standard as vi. Another rather poor choice would be a full installation of vim. Those are tools that belong to full installations ranging from your complete home setup with your favourite editor to university setups for shared computers with a choice of installed tools for a wide range of users.