The Cavalier, based on the long and romanticised history of the horse-riding, lance-wielding knight, is one of the bastard stepchildren classes of Dungeons & Dragons, something that almost everyone tries to sweep under the rug, yet which keeps popping back into the light no matter what is done by the fans (it's probably mostly due to that asshole Erik).
There are two specific breeds of Cavalier in the context of D&D. The original variety, known today as the Cavalier-Paladin, is a horror that only neckbeards of Old School Roleplaying lineage have experienced, and which has been more or less successfully stamped out, and the "proper" cavalier, who has manifested itself once per edition ever since.
The Cavalier-Paladin was an original creation of Gary Gygax himself, first appearing in Dragon Magazine #72, before appearing in the 1985 Unearthed Arcana splatbook and then a third time in Dragon #148. It was basically a super-Paladin, which is exactly why it earned so much hate; although it came with a bunch of powerful class traits, it combined the Paladin's already obnoxious mechanically-enforced Lawful Stupidity with an even more party-annoying obnoxious bit of "enforced fluff" - the actual need for the player to act like a Leeroy Jenkins, but constantly charging off to fight enemies, even when smarter approaches were required. Even the author of the revised version from Dragon #148 admitted that the Unearthed Arcana Cavalier was "overly complicated to play".
Needless to say, the Cavalier-Paladin made no friends in D&D audiences and it has mostly been consigned to the dustbin of history ever since.
The other version of the Cavalier has been around since Advanced Dungeons & Dragons. Essentially, it's a Fighter variant, revolving around increased skills at fighting from the back of the steed. From a kit in second edition (The Complete Fighter's Handbook, Player's Option: Skills and Powers) to Prestige classes in 3 (Sword & Fist) and 3.5 (Complete Warrior) to a Martial Archetype (class branch) for the 5e Fighter, it's fairly stable. Unlike the Cavalier-Paladin, though, it's not mechanically forced into being obnoxious... but it's still never really taken off.
Why? Because the Cavalier has always been a one-trick pony; good at fighting from steed-back. Put them in a situation where they can't ride their steed - like, say, crawling in your stereotypical dungeon - and they're basically a worthless half-fighter.
Pathfinder eventually took a shot at making a Cavalier class of its own, the first time it's been a full class since AD&D. Although probably more popular as serving as the foundation for the Pathfinder's Samurai class, it does manage to be more effective than Cavaliers have traditionally been - this is because it manages to be a two-trick pony, with a focus on teamwork through the use of challenges and features that bolster allies, which actually makes it pretty similar thematically to 4e's Warlord class.
While the Cavalier does have a code of conduct, depending on its order, the only penalty for violating it is losing one of their less important abilities for 24 hours and many are total non-issues. For example, an Order of the Cockatrice Cavalier is one of the more restrictive ones yet is basically automatic for any adventurer: They must work to advance themselves, never accept less than an equal share of the loot, must accept payment when it's given, and keep their interests above others, none of which is actually evil. One massive oversight of the class is its skill list contains no Knowledge skills, so they're not very good at recognizing nobility.
Curiously for a non-core class Cavalier has two of the more worthwhile non-core Prestige Classes devoted to them. The first, Battle Herald, focuses on the commander aspect by progressing the Bard's Inspire Courage alongside full BAB at the cost of mount progression, a cost which can be avoided a few ways or ignored entirely by trading it for something more useful. The second, Mammoth Rider, focuses on making the mount a giant, powerful engine of death. While this does exasperate the problem of taking your mount anywhere that's not a wide open wilderness, it's a lot more powerful when it can bring their giant saber-tooth tiger along.
While Pathfinder's cavalier is the best they've been, they still aren't great. While they have something to do if they can't bring their mount, it isn't all that powerful. Cavaliers are generally as low as Tier 5, though small cavaliers (who can bring their pony into dungeons but not in buildings in town) and better archetypes that trade away the mount may get up to tier 4.
|The Classes of Pathfinder|
|Core Classes:|| Barbarian - Bard - Cleric - Druid - Fighter - Monk |
Paladin - Ranger - Rogue - Sorcerer - Wizard
| Alchemist - Antipaladin - Cavalier |
Inquisitor - Oracle - Summoner - Witch
| Arcanist - Bloodrager - Brawler - Hunter - Investigator |
Shaman - Skald - Slayer - Swashbuckler - Warpriest
| Kineticist - Medium - Mesmerist |
Occultist - Psychic - Spiritualist
|Ultimate X:||Gunslinger - Magus - Ninja - Samurai - Shifter - Vigilante|
In Dungeons & Dragons 4th Edition, the Cavalier resurfaced as a Paladin Variant Class in the splatbook Heroes of the Forgotten Kingdoms; it was part of the Essentials line of reworked classes, and its basic premise can be summed up as "simplified Paladin", just like all of the other initial wave of Essentials classes - the Knight, the Slayer, the Scout, the Hunter, the Sentinel, the Mage, the Warpriest and the Hexblade. Just like these classes, though, it suffered from the same flaw of being mono-build.
Rather than the diverse ways the paladin could serve as either tank, beatstick, or healer, the cavalier is rather set in its ways. All cavaliers start with a Defender's Aura (an at-will aura that causes -2 to any attacks to people outside of the aura), Holy Smite (an multi-use/encounter attack that adds extra damage and dazing to an at-will attack), Righteous Radiance (an opportunity attack that deals radiant damage to anyone attacking people outside the aura), Righteous Shield (an encounter immediate interrupt that lets you take the damage instead of an ally and gives you +2 to attack next turn), and Valiant Strike (at-will attack that hits more often the more people surround you). The only real choice you get is in the Virtue you select: Sacrifice allows you to spend your Second Wind to heal an ally as a minor action, and Valor gives you a slightly better healing surge and a bonus to initiative so you can get stuck in faster.
Despite being named Cavalier, this path has surprisingly little to offer in terms of making mounted combat good - only one class feature at level 4 and a power at level 8. Even then, you'd need to either buy a proper mount or replace a utility power with the Summon Celestial Steed power to make use of them.
|Dungeons & Dragons 4th Edition Classes|
|Player's Handbook 1:||Cleric - Fighter - Paladin - Ranger - Rogue - Warlock - Warlord - Wizard|
|Player's Handbook 2:||Avenger - Barbarian - Bard - Druid - Invoker - Shaman - Sorcerer - Warden|
|Player's Handbook 3:||Ardent - Battlemind - Monk - Psion - Runepriest - Seeker|
|Heroes of X:|| Blackguard - Binder - Cavalier - Elementalist - Hexblade - Hunter|
Mage - Knight - Protector - Scout - Sentinel - Skald - Slayer - Sha'ir - Thief
Vampire - Warpriest - Witch
|Settings Book:||Artificer - Bladesinger - Swordmage|
|Others:||Paragon Path - Epic Destiny|