In recreational scuba diving, a dive master is the first professional certification you can get, at least for the two biggest certification agencies, Scuba Schools International (SSI) and the Professional Association of Diving Instructors PADI. To become a divemaster, the requirements vary slightly, but since the vast majority of divemasters choose to become a PADI divemaster, the rest of this write-up relates mostly to that certification agency.
Certification cards tend to be colorful and fun, but the professional-level cards are black (or at least on a black background). To get the coveted first-level black card labelled 'Divemaster', then, you have to do all manner of things. The actual certification itself can take as little as three weeks in a fully-taught program, or between four and eight weeks in an 'internship' program.
Before starting divemaster training, you need to have completed 20 dives, be certified to an Advanced Open Water level, have a rescue diver certification, and a recent first aid / CPR certification.
Getting certified as a divemaster
To be certified as a divemaster, you must show 'demonstration quality' watermanship. In normal English, that means you have to be a damn fine scuba diver. There are a series of 24 specific skills you have to be able to demonstrate to students under the water, broken down into their critical attributes, which should help them perform the skills when they need to.
There is a huge theory section of the divemaster course as well, including exams in physics, physiology, decompression theory, dive theory, risk management, etc.
In addition, you are re-evaluated on all your skills as a rescue diver in a as-real-life rescue scenario, you learn search and recovery skills (lifting heavy objects off the floor with lift bags), and have to do a series of tests to prove your watermanship - including a 400-Metre swim with mask fins, 15-minute Tread (last 2 minutes with your wrists out of the water), 800-Metre/Yard Swim, 100-Metre Inert Diver Tow (basically, dragging a tired diver through the water) the oft-dreaded equipment exchange, which is where a pair of divers have to 'buddy-breathe' (i.e. two divers breathing from the same single regulator) whilst exchanging their equipment.
So what can a divemaster do?
As a divemaster, you are able to perform certain tasks, and earn money from diving; in most countries, it is recommended that a diver who has not been diving for six months or more does a 'tune-up', just to check that their skills are still up to scratch, and to polish up on any skills that aren't yet fully there. Divemasters are able to do this, assist instructors on courses, and to lead certified divers around in the 'discover local scuba diving' programme. Basically, in many situations, a divemaster will be an underwater tour guide.
Sources: I'm currently in the last week of my PADI Divemaster internship on Koh Tao, Thailand, and vaguely contemplating to take my IDC - the dive instructor course.