Rangers have been in the game since OD&D
They have been in "officially published books" since AD&D 1e
OD&D Ranger - Strategic Review Issue 2, Summer 1975.
Original D&D was issued piecemeal to a great extent, with material coming out of TSR as fast as they could get it out. That was not fast. (Printing and publishing was a difficult and expensive process that we may not appreciate in the current time). The Mind Flayer, for example, was first officially published in Strategic Review Issue 1. The Roper (monster) and the Ranger first showed up officially in Strategic Review Nr. 2 on page 4. (See note at the end). You could play a Ranger in OD&D if you had the Strat Review article to hand and you rolled well enough to meet the minimum scores.
The Ranger, like the Paladin, was a sub class of Fighting Man.
Strength is their Prime Requisite, but they must also have both Intelligence and Wisdom scores of at least 12 each, and a Constitution of at least 15. The statistics regarding Rangers are (snip) (Strategic Review, Number 2, p. 4)
When AD&D 1e was published, the material in Strategic Review was slightly revised, minimum scores raised, and a few abilities adjusted as it was added into the PHB. For a lot of players, that's the first time that they saw it.
AD&D 1st edition
Rangers show up in AD&D (1978) in the players handbook (with they guys stealing a jeweled eye from a big statue).
The were a subclass of fighter originally:
Rangers are a sub-class of fighter who are adept at woodcraft, tracking, scouting, and infiltration and spying.
They were obligate good alignment:
All rangers must be of good alignment, although they can be lawful, chaotic, or neutral otherwise.
They had some pretty extensive stat requirements:
A ranger must have strength of not less than 13, intelligence of not less than 13, wisdom of not less than 14, and a 14 or greater constitution. If the ranger has ability scores of greater than 15 in strength, intelligence and wisdom, he or she gains the benefit of adding 10% to experience points
The were pretty powerful in combat.
They got approximately the same number of hp as fighters in the long run. They rolled two d8 for their hit points at first level. Fighters rolled a single d10. Rangers also maxed out at 11 hit dice instead of 9.
Being only 1 level behind straight fighter in gaining multiple attacks per round they were a capable melee class. They got to add +1 damage per their level to "giant" class creatures (which included orcs and goblins) which made them very effective damage dealers.
The were better casters than the other fighter subclass, paladin, in that they got spells a full level earlier at level 8.
They advanced faster than the fighter as well. E.g. 150,001 exp would be level 8 for a ranger while the fighter would still be level 7.
If you had the stats, you probably wanted to be a ranger
There are some limitations on the wealth they could own, but they still got the keep and lands fighters did at higher levels. A nod to their lore and power was the rule that no group was allowed to have more than 3 rangers in it at a time.
No more than three rangers may ever operate together at any time.
In short, they were pretty powerful.
From the players handbook with the winged helmeted guy riding the warhorse. I always assumed he was a paladin.
Two weapon fighting
Wearing leather armor, the ranger got the ability to use two weapon fighting without penalty. This meant they effectively got two attacks a around well before anyone else.
This edition granted them abilities of a rogue with move silently and hide in shadows being added to their repertoire.
Instead of adding a boat load of damage to a bunch of creature types. The rangers of this edition had to choose one like, "giants" or "orcs", and got a +4 to attack rolls against them.
The class also picks up animal empathy here. Domestic animals are all their friend. Guard dogs and other attacking animals are also likely to be friends.
When dealing with a wild animal or an animal trained to attack, the amimal must
roll a saving throw vs. rods to resist the ranger's overtures.
I like to think of the saving vs rods as the clever use of a stick to change the disposition of the animals.
Hit Points and Experience
The ranger uses the same hit dice as the fighter in this edition, but actually needs more exp per level.
Again, if you had the stats, you probably wanted to be a ranger
Given the option to be a ranger or a fighter, ranger is just more powerful. Also, fun to play. Think Aragorn or Legolas from Lord of the Rings.
From the book with the cover that was supposed to look like it was metal bound. This game system was a big divergence from the previous. Comparisons are difficult looking back, but in short, the ranger got nerfed. In this edition, rangers are not clearly a cut above their fighter counterparts.
Only a wisdom of 14 was a de facto requirement to be a ranger in this edition, but any rumpty with any scores could select it as their class.
They started out with more skills and skill points that their fighter counterparts.
The feat system in 3rd edition was extensive. There were a lot of feats that affected a lot of things, and the ranger didn't get many feats. Fighters got bonus feats every other level. So the ranger remained a light armor bow and arrow or two swords kind of class, while the fighter could do just about anything with the judicious application of feats.
The 4E Ranger was a strong striker class, with high damage, good mobility and the ability to switch between melee and ranged combat (though specialization helped). Twin Strike was a level 1 At-Will attack power which allowed the equivalent of two basic melee or ranged weapon attacks in a single standard action, with the drawback that neither attack added an ability modifier to damage. Their signature non-power ability was Hunter’s Quarry - they picked one enemy and did extra damage to them. The extra damage was less than a 4E Rogue’s Sneak Attack. (thanks to @GuybrushMcKenzie)
Ranger was arguably the best at the Striker role in that edition of the game.
There are many modern discussions about the ranger. They're still the animal friendly with favored enemies, but are not so clearly a cut above their mundane fighter counterparts.
Note: Strategic Review's material was to a much greater extent "official" material than Dragon Magazine came to be (Dragon replaced Strategic Review in mid/late 1976). To the frustration of some players at the time, Ranger did not make it into any of the supplements: Greyhawk, Blackmoor, Eldritch Wizardry, etc. From the PoV of TSR's meager publishing budget and production efforts, the decision to not issue it again if it had already been printed in Strat Review looks like a clear economics-based choice- Brian Blume's lead-in commentary in Strategic Review 2 illustrates how lean their financial position was at that time. You could play a Ranger in OD&D if you had the Strat Review article to hand and you rolled well enough to meet the minimum scores. (In Strat Review No 4, Winter 1975, the Magic-User sub-class Illusionist arrived and was later found in AD&D 1e PHB, like the Ranger, without being in other supplements ... again, it was already published). The distinctions that we now make between "UA" and "Official Books" material from the publisher was not made then.