Well, in the beginning, Magikarp trainers are Game Freak's way of giving you "Experience Fodder". In farming terms, fodder is the hay stuff you give cows, and you give them fodder by the bucket-loads. This is just a term meaning free, easy experience, although not a lot.
Level bases are lower in Johto, so many trainers may still have a level 4-6 in their team. The magikarp teams can give these weaker Pokemon 70-90 EXP, AKA, a free level, in most cases.
To simplify it: Magikarp Trainers, if not for the Gyarados-infested rematch teams, are usually to help weaker Pokemon catch up early in the game, so that you don't ditch them or so they don't fall behind.