In a literal sense, a board on which a mason carries mortar.

But usually, a name for the square flat black cap worn by graduates. It consists of the rounded cap to fit over the head, topped with a stiff flat square resembling a mason's mortar board, and adorned with a tassel. Bachelors and masters wear it, but a doctor has a soft bonnet instead.*

The term is slang, at least in origin: the proper name for it at Cambridge is simply a square. The name "mortarboard" is fairly modern, about 1850, although obviously the actual use of the garment, as a flattened biretta, is quite old. The first known use of the word is in a book The Adventures of Mr. Verdant Green, an Oxford Freshman by Cuthbert Bede (pseudonym of Edward Bradley). At that time it was clearly slang and derogatory, as evidenced in this quotation:

"I will overlook your offence in assuming that portion of the academical attire, to which you gave the offensive epithet of 'mortar-board'; more especially, as you acted at the suggestion and bidding of those who ought to have known better".
It was apparently in the 1700s that the crown of the headgear flattened to a board. The tassel was added in the nineteenth century: some institutions use the colour of the tassel to indicate faculties or suchlike, though normally it is plain black. (Cambridge jargon: wonderful!)

* Or at least, so it is in the English-speaking world. I've since writing this seen pictures of graduations in places like Portugal and Poland where the caps are not at all what I'm used to.