You're misreading the Posse Comitatus Act. The law does not say "the military may not be used for law enforcement." It says "the military may not be used for law enforcement, except in cases and under circumstances expressly authorized by the Constitution or Act of Congress." The Posse Comitatus Act was never about banning military use in law enforcement. It was designed to control military use in law enforcement. The title and text should be a hint about the actual effect of the law: there's a reason they talk about "posse comitatus."
Posse comitatus isn't the same as "law enforcement." It's a specific power law enforcement officers have, allowing them to command the assistance of able-bodied citizens to enforce the law (think "forming a posse," because that's what it is). Sheriffs traditionally had posse comitatus authority; so do federal marshals. At least for marshals, this authority was often used to get assistance from local soldiers. Soldiers were routinely used to back up the marshals. This could be done to enforce any federal law, and the marshals didn't have to try civilian methods first. This is what the text of the Posse Comitatus Act bans: routine use of the military by local authorities to enforce federal law. It was not intended to say "Congress must approve each specific use of the military." It does not in fact say that. It says "Congress and the Constitution can set out rules for the use of the military in law enforcement, but unless a law says the military can be used it can't be used." Source (CRS).
The provision letting marshals summon assistance doesn't explicitly say "including military assistance," so marshals can't summon military assistance. On the other hand, 42 USC § 1989 (warrants for certain civil rights crimes) does explicitly allow people executing the warrants to "summon and call to their aid [...] such portion of the land or naval forces of the United States, or of the militia, as may be necessary to the performance of the duty with which they are charged." So those warrants can be enforced by the military. 16 USC § 593 says the President may use the military to prevent illegal logging of federally owned timber in Florida.
And of course, you have the general law, predating the Posse Comitatus Act, which the Act was in no way meant to modify: the Insurrection Act. Remember how I said the Posse Comitatus Act was meant to deal with informal use of soldiers as a posse? The Insurrection Act represents what was considered an acceptable use of soldiers: authorized by the President himself, as the ultimate tool through which the United States exercises its sovereign authority within its borders. Source (CRS). Use of soldiers is a last resort; the President may only approve it under the Insurrection Act when he determines that the civil authorities are unwilling or unable to enforce the laws. The President must make a proclamation ordering those involved to disperse. But once the President has invoked the Insurrection Act, the Posse Comitatus Act does not apply. Under applicable DoD policy, enclosure 3, section 1.b, action under the Insurrection Act is a category of permissible direct assistance that is not restricted by law or DoD policy. A commander may choose not to deploy soldiers for law enforcement tasks (as happened in the LA riots), but the Insurrection Act perfectly falls under the exception in the Posse Comitatus Act (which is not surprising, seeing as it was written after the Insurrection Act with no intention of changing that law).
Interestingly enough, despite the Posse Comitatus Act apparently forbidding this, DoD policy recognizes two situations where the military may directly assist civil law enforcement in an emergency without any statutory authority. DoD bases this on implicit constitutional authority, specifically:
the inherent legal right of the U.S. Government - a sovereign national entity under the Federal Constitution - to insure the preservation of public order and the carrying out of governmental operations within its territorial limits, by force if necessary.
When there is an unexpected large-scale civil disturbance that local authorities are powerless to stop, local military commanders may intervene to stop widespread loss of life or wanton destruction and restore order to the point that civil authorities can take over, as well to protect federal property and functions if civil authorities cannot.