When pertaining to video games, passwords are a largely obsolete way of tracking progress, and allowing players to retain progress (as opposed to kicking them back to the start every time.) Generally, when quitting the game, after the end of the stage, or at some other stopping point, a password is displayed. Assuming the player bothered to write this password down, he or she could enter the password into the appropriate screen, and voila! Start somewhere approximating where he/she left off.
Passwords were usually relatively simple codes (sometimes even logical words) to return to a specific stage, and such passwords were common in straightforward games, ones with no inventory or other attributes to track other than linear progress. (Occasionally, games with inventories or similar attributes would use these kinds of simple passwords, making it easy for people to cheat or causing players to lose everything they've collected; Desert Strike and Super Empire Strikes Back both had this flaw.)
Less common were complicated, nonsensical strings of characters used to keep track of more than just progress. While this isn't particularly efficient, and these passwords were often cracked (allowing for easy cheating), these kinds of passwords were cheaper than battery-backed save games. Metroid, Deadly Towers, and the entire Mega Man series until Mega Man 8 used these kinds of complex passwords.
Passwords don't always use conventional letters and numbers. The Mega Man series, for example, uses a small matrix of dots, an obnoxious form to transcribe. The only real reason to use passwords like this, other than stylization, are pictoral passwords, used in games (usually games based on children's cartoons) where the player may not yet know how to read and write.
Passwords became common in the post-Atari 2600 era, as linear progress became more important than score. They had their heyday until the prevalence of battery-backed save in 16-bit games, although password-based games persisted until the PlayStation and its flash ROM memory cards became popular. Passwords saw a much quicker death on PCs, disappearing right about the time that hard drives became common.
The greatest strength of passwords is their simplicity. It's fairly easy to implement a password system in any game without any kind of inventory. Additionally, passwords would theoretically also be very useful for transferring progress between different versions of a game on different platforms, although this benefit was very rarely seen.
The greatest weakness of passwords is their inefficiency. Any game with more variables to track than "Stage X" will become increasingly more complex, especially if the password needs to be hard to crack. The fact that cheap, quick ways to save games are available on almost any common platform for games continues to assure the obselescence of game passwords, as well.
Contrast with: cheat code