In a military context, a mortar is an indirect fire weapon, often muzzle-loader, firing shells using a gunpowder propellant. Mortars are short-barreled, having barrels with a length 10 or less times the caliber, or muzzle diameter.
The short barrel is optimized to fire at a higher angle than a howitzer, which has the disadvantage of shorter range, but the advantage of being able to fire over obstacles. The high trajectory lets it be fired from a much smaller area then howitzers or direct fire weapons, so it can be fired through a small opening in the roof of an armored vehicle, or from a dugout.
Mortars go back to the earliest aspects of siege artillery, and especially attacks on land positions from ships. Where the first siege cannon were direct fire weapons intended to batter down walls, a mortar, firing hollow shells filled with gunpowder or incendiary material, could fly over the wall to wreak havoc within it.
Given both the limitations of metallurgy and explosives, early mortars were enormous by today's standards of man-portable or truck-carried weapons, but were still compact compared with other artillery of the time. 13" caliber mortars, for example, were not uncommon on ships of the Napoleonic period and American Civil War. C.S. Forester's novel Lord Hornblower contains a vivid account of using purpose-built, mortar-armed bomb ketches against shore installations.
In both World Wars, Germany made use of superheavy mortars against fortifications, the extreme example being the 800mm "Dora". Some of the weapons, such as the WWI 420mm "Big Bertha", were technically howitzers, with a barrel 12 calibers long. By whatever name, they were effective before heavy air bombardment was available.
The largest caliber mortar ever built was the 36-inch (914mm) WWII U.S. "Little David" It was originally developed as an ordnance development device for testing gravity bombs, but was considered, in 1944, for use against German fortifications.  It was never used in the field, probably because air-delivered gravity bombs, were more effective against heavy fortifications.
Current land forces use
Light mortars, with a caliber of roughly 50-90mm, are easily carried by well-conditioned troops, and give the infantry commander an indirect fire capability, of longer range than most infantry weapons, under his immediate control. Medium mortars are principally 81-82mm which still can be carried although in several pieces, to 120mm mortars that need to be transported with a vehicle. Still, one of the great attractions to mortars in Western militaries is they are organic to maneuver units and provide direct support, and can be brought into use without the more extensive coordination required by field artillery.
Heavy infantry support (107 and 120mm) mortars are usually transported in a mortar carrier vehicle, from which they can be fired although dismounted operation is sometimes an option. Western-designed mortar carriers are more likely to provide dismount capability than Soviet designs that put the mortar in a more protected turret.
Even heavier mortars (e.g., 240mm), assigned to artillery rather than infantry units, are less common, but some militaries, such as the former Soviet bloc, find them quite useful. Such mortars are usually towed by a vehicle, but can be moved much more quickly than an artillery piece.
Mortars are most often smooth-bore, with fin-stabilized shells, and are quite simple mechanically. They tend to be mounted on a bipod and metal base plate on the ground. All these features make them far simpler to construct than cannon. Simple light and even medium mortars can be improvised, either as single-shot weapons, or for use in guerrilla warfare when the guerrillas have little outside support.
The most common filler for the warhead of a mortar shell is high explosive, which does damage by blast and fragmentation. Illuminating shells work well with the high trajectory of a mortar; when fired at night, they burn overhead and light the area. White phosphorus is another load used to create smoke or start fires.