The earliest relevant usage in any English language source that I could confirm via Google Books was Somaliland in 1783. According to the Online Etymology Dictionary, the term Somalia dates to 1814 and is of "unknown origin".
So Somaliland appears to be the "original" English name, but was rarely used until later on. The terms British Somaliland and Italian Somaliland appear together in Parliamentary records published as early as 1851:
On the north side of the Red Sea was British Somaliland, and on the
east and south was Italian Somaliland, and to the north - west of
British Somaliland was Abyssinia...
A Google Books Ngram of English-language sources covering 1840-1890 suggests that use of "Somalia" and "Somaliland" may have alternated at different points during that period. Note that many of the earlier appearances of "Somalia" on that graph are not actually relevant hits, but many of the later ones are.
It is very easy to find relevant usage of "Somalia" in the 1890s. But another Ngram covering 1890-1970 shows that in that period, "Somaliland" was clearly preferred in the first half of the twentieth century, with its popularity gradually declining after independence.
"Somaliland" is still used today in reference to the wider region where Somali people live, including parts of neighboring countries, while "Somalia" refers specifically to the nation-state.