A mine was a tunnel dug under the walls of a castle to make them collapse. Once under the walls, sappers would build wooden structures to hold up the tunnel that they had made. The tunnel would then be filled with flammable material and set on fire. Later, explosives were used for greater effect. If the sapping was done well the wall above it would fall down creating an entrance for the attacking army.
Peter of les Vaux-de-Cernay recounts how at the battle of Carcassonne, during the Albigensian Crusade, "after the top of the wall had been somewhat weakened by bombardment from petraries, our engineers succeeded with great difficulty in bringing a four-wheeled wagon, covered in oxhides, close to the wall, from which they set to work to sap the wall" (les Vaux-de-Cernay, 53).
As in the siege of Carcassonne, defenders worked to prevent sapping by dumping anything they had down on attackers who tried to dig under the wall. Successfully sapping a wall usually meant the end of the battle since either the defenders would no longer be able to defend and surrender, or the attackers would simply charge in and engage the defenders in close combat.
Sapping saw a brief resurgence as a military tactic in WWI when ambitious army engineers would attempt to break the stalemate of trench warfare by tunneling through No Man's Land and laying large quantities of explosives directly under the enemy's trench. This was possible due to the very static nature of that era's fighting. By WWII troop movements were too fluid, and tunneling too slow, for sapping to be worth the investment of effort.