It's easier to get in than it ever has in the past. A useful thing to consider is if you are set on playing "D&D" as it name-branded D&D or one of the many, many "clones" which have been put out there (most of which are, D&D, with minor modifications).
Actual D&D
The current 5th Edition of D&D has starter rules available for free download. 5E is cleanly written and fast, which makes it useful for new players. However, the free rules only give you a narrow set of character options - which may not be an issue for new players.
D&D 3.5 is the most complete set of rules you can get for free, as the core rules exist online from their attempt at open sourcing with the D20 system. Rules, monsters, spells, etc. D20 however is only so-so for new players - it's got a decent amount of moving parts to the system, relies heavily on knowing how to build a character, and either works best with having minis and a grid or throwing out a lot of rules about Attacks of Opportunity, etc. So this makes it less useful for new players.
Although 4th Edition is the most recent "last generation" of D&D, and you can probably find the books used everywhere, the game does work best with minis and a map, and has a lot of map specific strategies - which tends to either make things harder or easier for new gamers based on how much they play other strategy type games. Between cost and this issue, it might not be the one to go with.
Older D&D - some legally sold PDFs of older D&D and reprints (and of course, original used books) are out there. Older D&D usually suffers from difficult writing and high lethality which isn't the greatest combo for new players.
Close Enough Clones
Swords and Wizardry is a free PDF clone - they've got a Whitebox version which means even simpler rules, but much more clearly written than actual old whitebox D&D. The print copy is super affordable as well.
Outside of that, you can find lots of lists of free or cheap retroclone games. This question from before has a large list of example retroclones with people talking about the various qualities of each. Wikipedia has an entry on some of the more well known retroclones and descriptions of them. You can also find "master list" threads or wiki entries where people gather links and descriptions.
Benefits: Most are free PDFs, very affordable otherwise, lots of people have chimed in so you can review what you want to play or not, how supported it is, and get a look to see how cleanly written it is.
Drawbacks: Not labeled "D&D", if that's a big sticking point. Most are based on older versions of D&D which is usually high lethality for characters. Some are explicitly designed for dungeon crawls which either is exactly what you're looking for or exactly NOT what you're looking for.