Some organs in the body can not utilize ketone bodies for energy. Examples include RBC's and the liver. Therefore, it is essential that glucose levels are maintained even if there is a high level of ketone bodies.
Pyruvate carboxylase is an enzyme needed for gluconeogenesis. If someone has pyruvate carboxylase deficiency, they mostly rely on carbohydrate intake to maintain glucose levels. On a ketogenic diet, glucose levels are maintained mostly by gluconeogenesis from proteins, since the carb intake is minimal. Therefore, if someone who has pyruvate carboxylase deficiency goes on a ketogenic diet, they will likely have low levels of glucose due to the lack of gluconeogenesis and lack of carb intake.
I am a little less clear about the contraindication in porphyria. What I do know is that glucose is an inhibitor of the first step in heme synthesis (which is ALA synthase converting succinyl CoA and glycine to ALA), and that we typically give glucose to patients with acute intermittent porphyria to inhibit the production of the porphobilinogen (an intermediate in the heme synthesis pathway, and the causative agent of the symptoms in acute intermittent porphyria). Patients on a ketogenic diet generally have a lower glucose level than they would have if off the diet, although their glucose level is still within normal limits. I presume that this relative lowering of glucose can disinhibit ALA synthase, and thus make it more likely to develop the symptoms of porphyria.