The ancients pictured their land ringed by the
四海 (four seas), so
海内 meant all of China, or the whole known world.
王勃's farewell line
海内存知己,
天涯若比邻 (with a true friend anywhere within the seas, the ends of the earth are next door) is a classic. Today the word mostly appears in
海内外, at home and abroad.