Oliphant is simply an old spelling and/or pronunciation of elephant.
The word "elephant" is based on the Latin elephas (genitive elephantis) ("elephant"), which is the Latinised form of the Greek ἐλέφας (elephas) (genitive ἐλέφαντος (elephantos1), probably from a non-Indo-European language, likely Phoenician.2 It is attested in Mycenaean Greek as e-re-pa (genitive e-re-pa-to) in Linear B syllabic script.[3][4] As in Mycenaean Greek, Homer used the Greek word to mean ivory, but after the time of Herodotus, it also referred to the animal.1 The word "elephant" appears in Middle English as olyfaunt (c.1300) and was borrowed from Old French oliphant (12th century).2
https://en.wikipedia.org/wiki/Elephant#Etymology
I note that in medieval times many surnames came from where people lived, and that inns were named after the images on their signs, images which sometimes included elephants. And presumably the ancestors of actor Peter Oliphant were named after the elephant on the sign of their inn.
https://www.imdb.com/name/nm0646477/
So Tolkien the language expert probably knew all about the former spelling of oliphant instead of elephant.
But it is possible that Tolkien may have been familiar with the Afrikaans world olifant and as a child continued to say olifant instead of elephant for some time after travelling to England where everyone else would say elephant.
If Tolkien ever did see any African elephants as a child in South Africa, he may have noticed how different the zoo and circus elephants in Britain, mostly Asian elephants, were. So possibly at some time Tolkien as a child spoke of wild "olifants" in Africa and much smaller tame "elephants" in Britain.
Tolkien was a child less than a lifetime after the African bush elephant was accepted as a separate species, Loxodonta africana from the Asian elephant, Elephas maximus. It is quite possible that the adults in Tolkien's family were not aware they were separate species and considered them to be races or varieties of a single species. If Tolkien was more observant as a child, he might have insisted African "olifants" were different from Asian "Elephants" until the time he was old enough to learn that they are classified as separate species and genera, Loxodonta africana and Elephas maximus.
And as an adult Tolkien would have read about extinct proboscidean species such as mammoths and mastodons which survived until about ten thousand years before Christ and thus co existed with modern elephants. Thus Tolkien could imagine that several species of proboscideans existed at the time of the War of the Ring, and were collectively called "Olyphants" by Hobbits, and that the Mumakil was the largest species in that era.
But that is only speculation about what Tolkien might have known or felt about the "Olifants" in Africa as a child.
What we do know is that Tolkien knew about the origins and variant forms and archaic spellings of the words that he used.