They actually took the idea from the Supaidaman tokusatsu (Based on Spiderman) that started airing in 1978. They noticed that Supaidaman's spandex enabled better stunts, as Super Sentai is very acrobatics based. (Also, notice the male stunt doubles for female rangers curiosity)
Spandex is a cheaper material, and it probably makes the stunt actor able to do more elaborated fight choreographies. The only problem is that, due to Toei being almost unable to get female stunt doubles, it’s basically impossible to cover that the female ranger’s stunt double is a man, and this is why the girls wear a skirt.
The first 6 seasons of Super Sentai, starting with Himitsu Sentai Gorenger in 1975 wore cloth with capes and other accessories. In 1982, the first Super Sentai season to debut the spandex idea based off Spiderman tokusatsu was Kagaku Sentai Dynaman.
Nowadays, they keep it because of tradition. Super Sentai is a very important franchise in Japan, and it has its identity to uphold since they make a new one every year and they have as of now: 41 seasons.
Basically, Super Sentai became tradition in Japan and Saban bought the rights to do their own thing in USA. However, the original Power Rangers only hired the actors to do the none-costume scenes and actually used the original fighting takes from the japanese show: Kyōryū Sentai Zyuranger (the 16th Super Sentai Season). In the original fighting scenes from Mighty Morphin Power Rangers (MMPR), everything is dubbed, so they had to keep the same costumes from Zyuranger.
Trivia: If you ever wondered why the Yellow Ranger didn't have a skirt, that's because her japanese counterpart was a man.
MMPR threw Zyuranger to the wind. It didn’t care what the plot was; it was just bending the footage any way they could to get 40 episodes.
MMPR would tell wacky stories of the day that just happened to have a ground battle and zord fight to take up a third of the episode. This was the whole premise behind adapting footage from Sentai. It was a cost cutting measure. Cut out anything too Japanese, remove any excessive violence or just plain weirdness. Get a third of the episode to use footage, no matter what Saved by The Bell plot would get you there. Even if you might see a Japanese kid in the background. It didn’t exactly stay that way…