Any player can play in goal provided he or she wears a distinguishing jersey.
And this used regulary to happen in the days before substitutes were allowed. Even when a player was injured no substitute could be brought on, prior to about 1966. Indeed I believe when England won the World Cup in 1966, substitutes were still not allowed.
Where a goalkeeper had to go off, an outfield player would take over the gloves and jersey and go in goal.
Sometimes a goalkeeper, where only slightly injured, would go on to play as an outfielder as a makeweight, while someone else took over the goal.That happened in the 1957 English cup final.
The Manchester United goalkeeper, Ray Wood, had his jaw broken in the sixth minute. He had to come out of goal, but came back on as a winger. The following is taken from Wood's obituary in The Guardian newspaper of 9 July 2002:
In that 1957 Cup Final, United faced Aston Villa, and were strong
favourites. They would surely have won had Wood not been so severely
fouled. Today, a substitute goalkeeper could have come on, but there
were no permitted substitutes in those days, and Wood eventually
returned to the field with his arm strapped up, to limp along the left
wing. The game was only six minutes old when Peter McParland, Villa's
outside-left, closed in to meet a cross from the right with his head,
some 12 yards out. Wood caught the ball without difficulty and, in
normal circumstances, would simply have cleared it upfield or thrown
it to a colleague. McParland, however, came hurtling at him, failed to
make contact, turned back, and crashed into the unfortunate Wood, who
collapsed in agony, his jaw bone broken. Jackie Blanchflower went in
goal, but Villa won 2-1.