The active ingredient in Ponstan is mefenamic acid. It is categorized as a non-steroidal anti-inflammatory drug (NSAID).
It works because it
is a cyclo-oxygenase (Cox-1 and -2) inhibitor and blocks the production of intracellular prostaglandins that are important in pain and inflammatory pathways. Mefenamic acid has analgesic as well as anti-pyretic and anti-inflammatory activities, but is used largely for treatment of pain.
Basically, like a lot of painkillers, it inhibits the transmission of pain signaling.
As for speed, how fast NSAIDs lead to less pain depends on a lot of things, including the severity of the pain or when the patient last ate, it can't really be generalized. A very fast relief might also be caused by the placebo effect just by having taking medication.