Swords have been used in combat since the Bronze Age; the last recorded instance of the use of a sword by military personnel (as far as I am aware) was Mad Jack Churchill, a British officer in the second world war who carried a longbow and a claymore into action.
Swords were considered an ultimate status symbol for a long time; there was a reason for this. A well-made sword was considered a badge of rank in the dark ages, as it could cut through most armour. Swords were combat-effective wherever the opposition was not wearing full-plate armour.
If someone was wearing full plate, a sword wouldn't be much use; it would be much easier to use a heavy, blunt weapon like a warhammer or a mace to cause crushing injuries, or a sharp polearms which could be used to knock the opposition over and then work away at weak spots in the armour.
Swords could penetrate padded cloth, leather, chain-mail and scale-mail. This meant that they could defeat any armour until the 1300s, when plate armour came into more widespread use, and even then it would be over 100 years before full plate was developed, and even full plate had its weak spots.
Cutting/hacking/slashing = sweeping the sword across an opponent's body to lay open flesh or sever limbs.
Thrusting = stabbing; pushing the sword point-first into an enemy's body. This was fairly uncommon in the middle ages as this is the easiest way to break a sword.
There were swords of all sizes used in the middle ages, generally with different purposes. A mounted knight would often carry a longsword to use when he broke or lost his lance after charging, and this would be held in one hand while the other held his shield and reins. A knight on foot would often carry a one-handed sword too, with a shield in his other hand. Some specialist troops would carry a sword so large that it required two hands; examples include the German Landsknechts.
However, ordinary foot soldiers could not always afford a sword, so unless they gained one that they had looted from a battlefield, they would be equipped with a spear or similar polearm, a dagger and maybe a shield.
Swords became more common as the years went on; by the 1600s they were cheap enough to be carried by every soldier in an army, although they had been replaced by muskets and pikes as primary weapons. By the 1700s the only soldiers likely to use their swords were cavalrymen, and footsoldiers stopped being issued swords. By the 1800s only cavalrymen and infantry officers carried swords, normally backing them up with a carbine or revolver. This remained the case until world war I, when close combat was so rare that swords were reserved only for ceremonial purposes, and all members of an army were issued rifles.