There are two reasons for the martial law: an immediate and a more long term problem. The immediate issue at hand is the presidential election and the supreme court. Musharraf won the election, boycott by most of the opposition, but the Supreme Court has been threatening to void his election because Musharraf holding both the presidency and his army post. This continues a long feud between the court and presidency. When martial law was declared, the court called on the army to resist. Only to have Musharraf go one step beyond Abraham Lincoln and lock the court justices in the Supreme Court building.
The long term reason for martial law is the rise of Islamism in nuclear Pakistan. The Swat Valley is now a Taliban/al Qaeda stronghold as is the greater area, North-West Frontier Province and the Federally Administered Tribal Areas. Al Qaeda is waging a civil war against Musharraf with hopes of getting its hands on nuclear weapons. Pakistan's military is demoralized because of a series of loses to the militant thugs. The militant also have a large backing from the general public. Musharraf hopes he can use his new powers to crush any opposition.
From The Long War Journal: Red equals Taliban control, purple equals de facto Taliban control, yellow under threat
So in short: Military thug versus Evil.
The wild card in the picture is Benazir Bhutto and her center-left (socialist but very anti-Taliban) Pakistan People's Party. Bhutto stood on the sidelines in an agreement with Musharraf which allowed him to be reelected president. However, after the election Musharraf tried to delay Bhutto's return and al Qaeda attempted an assassination on her (it is unclear how much Pakistani police did to stop the attack). Bhutto is returning from a foreign trip and may be so tired with Musharraf she could lead a popular revolt. She has enough support to greatly damage Musharraf's standing. However, if Musharraf falls there is no guarantee Bhutto could hold power. The Taliban and their al Qaeda friends would certainly see it as a time to strike.
Pakistan is certainly a place to be watching in the next couple of days.