Well, that depends on what you mean by play.
MIDI was desigend originally (back about 1983, IIRC), to connect professional music equipment togeather. Mainly analog synths and such. It is a serial interface, that transmits data when a key is hit on one keyboard, sending a message saying that a key has been hit, which key, how hard it is hit etc. It also could send volume info, patch change info etc… Those of us who were playing keyboard back then loved it. It allowed us to have one main keyboard, and a whole bunch of boxes that just made differant sounds on stage rather than being surrounded by a stack of keyboards. Each box could be assigned one of 16 channels, and just by switching the channel the mast keyboard was on, we can change what instrument we are playing. Since my keyboard rig included a piano, and electric piano, a clavinet, and several synths, this allowed me to condense down considerably, and my band mates were much happier.
Somewhere along the line someone created a card for a computer to allow it to speak midi. It allowed it to record which keys you hit when, and play them back. This was a lot more effecient than recording the actual sounds your keyboard was making because it took up very little space on the drive(often a floppy), and you could edit what you played, switch instruments after the fact, and so on. The most popular of these MIDI interfaces for the PC was the Roland MPU-401. It could be used in a couple of ways: One, you could have it timestamp all the data coming in so when it was played back it would be correct(on old slow machines this was important), or it had what was call uart mode. This just recorded the raw data coming into the computer and left it up to the pc to time stamp. Soundblaster, when they came out with thier sound card, included a MPU-401 compatible midi interface that would work in UART only mode. at first, this was hardly useable. Most of the software we were using to record back then used the timestamp feature, so the Soundblaster woudlnt work. Gradually that change(especially after Windows 3.10 when it started suporting the midi interface directly. A lot of MIDI only sound modules were out there, and there were two that got real popular. The yamaha FB01, and the Roland MT-32. In fact, Roland made a PC sound card with a built in MT-32. Severl game designers started includeing support for the MT-32, and a few included the FB-01(I think the early kings quest games did). gradully, the MT-32, which had pre-programmed drums, evolved into the General MIDI standard. A general MIDI sound module was a sound module that had a pre-defined list of sounds, all assigned to specific channels and patch numbers. That way, a computer program would know for instance, that if it sent a certain note on channel 10, it would get a bass drum. Channel one is a piano(if I remember right). General MIDI took off, and people started offering General MIDI daughter boards for the sound cards that were out. Then, sound cards started coming with general midi built in, as well the FM sythesis that had been built on to the card all along(I am not going to try to explain FM Synthesis, unless someone really wants to be that bored). Games now started supporting it. A new file format came out, the Standard Midi File. This file allowed all the differant software programs for the differant computers to share MIDI recordings(called sequences), and now allow you to download a cheesy redition of smoke on the water done in general midi.
So, if your sound card supports General Midi(almost all do), and you have a song in standard midi file format(.mid on the PC), you can play this back. If you want to create you own MIDI file, there are a ton of programs out there to do it with(cakewalk is my favorite). It is much easier if you have a midi keyboard(these are now pretty cheap), to plug into your MIDI interface(some will even work with just USB), but it can be done with just your computers keyboard.