Here is the relevant information from the Wikipedia article on Promotion and Relegation. Originally the teams who finished bottom of the Football League (the top competition at the time) faced a process of re-election.
The new league was not universally accepted as England's top-calibre competition right away. To help win fans of clubs outside
the Football League, its circuit was not closed; rather, a system was
established in which the worst teams at the end of each season would
need to win re-election against any clubs wishing to join.
The Football Alliance (formed 1889) merged with the Football League in 1892 but not on equal terms. Most of the Alliance teams were entered into the newly formed Football League 2nd Division. The top teams in the 2nd division then replaced the worst teams in the 1st division.
For decades, teams finishing near the bottom of The Football League's
lowest division(s) faced re-election rather than automatic relegation.
But the principle of promotion and relegation had been firmly
established, and it eventually expanded to the football pyramid in
So the system of relegation evolved from a series of mergers with other leagues, teams from the newly merged leagues would be entered into lower leagues like the 2nd or 3rd and earn promotion through their league standing rather than election to a higher league. I guess the system came about to ensure their was equality for all the teams and that teams were not gaining promotion based on how teams were voting.