The Wikipedia says that Japanese katakana vowels “The gojūon inherits its vowel and consonant order from Sanskrit practice. “. Could expert explains this in easy language?
Due to the study of Buddhism and its scriptures in the source language (either Buddhist Hybrid Sanskrit or Pali) Japanese scholars were aware of the structure of the Indic scripts finally coming from the tradition of Sanskrit. When they created the Katakana they applied the ordering priciples of the Devanagari Script to it; the deviations (i.e., the ordering of the consonants s and h) can be explained by later sound shifts: The /h/ was a /p/ originally and developped via /ɸ/ to /h/, the /s/ was a /ts/ originally and thus closer to the Devanagari letter ca (च).
EDIT: Incorporated information from the comments