What changes or advancements I would need to give the 19th century army to give them a fighting chance against [a Marine Expeditionary Force]?
You need to give them a complete 21st century command structure, plus 21st century training... or at least post-WWII. They need 21st century C3I: Command, Control, Communications, Intelligence.
Nothing else will do. Dressing up a 19th century army with 21st century equipment and they're still a 19th century army with 19th century training, tactics, organization, logistics, and leadership. Giving them a few 21st century commanders will not do, they'll still be leading a 19th century Napoleonic army with a 19th century staff and officers and 19th century training and thinking.
Here's why.
30,000 Marines With Muskets Are Still 30,000 Marines
...and an unwieldy Napoleonic army with M16s is still an unwieldy Napoleonic army.
This is no contest. The pace and tactics of warfare have so changed and evolved so much since the Napoleonic Era that a 21st century army, even one 20 times smaller and equipped with Napoleonic equipment, would wipe the floor with a Napoleonic Era army.
The Marine's greatest weapon is not their fancy guns, but their mastery of C3I: Command, Control, Communications, Intelligence.
Expeditionary
If you're going to send a military unit back in time to fight, an MEF is a good choice. They're fully self-contained, and lean: every one is a trained rifleman. An MEF features a Marine Division for ground combat, air wing, logistics group, an expeditionary brigade, and three Marine Expeditionary Units. The brigade and MEU also have their own ground, air, and logistics assets.
This means not only can they operate completely cut off, they're designed that way. This puts them in very good shape when they appear in the 19th century. This is what it means to be "expeditionary".
Technology Will Fail...
As others have noted, their technology will quickly break down once their supply of fuel and spares are gone. Maintenance units will be able to keep things together by stripping units for spare parts, and fabricate others; the lack of high quality steel and aluminum will make that very difficult. A small amount of diesel and jet fuel (which is basically kerosene) could be made on site, but not enough to fuel an MEF. Batteries can be recharged with the solar and wind generators they have on hand, but eventually the batteries will wear out.
Small arms will last longer, a well-maintained M16 will run forever, but ammunition will be a problem. While the brass cases can be reloaded, and bullets can be made, obtaining smokeless powder and primers will be a challenge considering they won't have been invented in the Napoleonic Era yet. Someone within the MEF will know enough chemical engineering to get that going, but it will be some time to get it set up, and more time to perfect their production to meet the tolerances of modern firearms. Still, they will be able to produce small arms cartridges that will safely fire, even if it might not cycle the action reliably. That is still an enormous advantage over a muzzle-loaded musket.
Point is, they have, perhaps, a few hundred hours of combat operations before their technology really falls apart. During that period they'd use their massive advantage to defeat the army in the field, acquire a base of operation, and capture sufficient supplies and weapons.
The only question is what to do with all the prisoners.
...But You Still Have 30,000 Well-Trained Marines
A 21st century MEF has so many non-technological advantages over a 19th century army it's not even a fair fight. It comes down to C3I: Command, Control, Communications, Intelligence.
In a 19th century army, the soldiers are poorly trained, and mutinous. Communications are very poor, but officers are not given independence. The result is an emphasis on drill, and remaining tightly packed for morale and control issues. Units are only capable of simple maneuvers. Battles happen during the day, in large open fields with good sight lines for the commanders so they can see what's going on and issue orders, and no obstructions to break up their formations.
This basic problem of command and control plagued military tacticians well into World War I and World War II. It's not until the introduction of Stormtrooper tactics late in WWI that we see something recognizable as large-scale modern military tactics.
In sharp contrast 21st century Marines are all highly trained, motivated riflemen. Even without 21st century equipment, their communications will be excellent. But more importantly tight control is not as needed allowing them to be flexible in ways a Napoleonic commander would consider utter chaos. Small unit commanders have the training, authority, and independence to accomplish their goal without constant command and control and can range far and wide across the battle-space wrecking havoc from all directions.
The 21st Century Pace Of War
The pace and scope of warfare has also changed. Napoleonic armies fight during the day at chosen battlefields. The rest of the time they're resting, marching, foraging, and training. The battle happens on the battlefield. In contrast, to a Marine, everywhere is the battlefield all the time.
While the large Napoleonic formations are still marching toward the battlefield in long columns, Marine platoons will be scouting and infiltrating around their flanks and rear. Before the army can even reach the battlefield and form up, they'll be constantly under hit-and-run attack from all sides. Napoleonic armies do not react well to being surrounded and constantly harassed, they'll be confused, hesitant, and demoralized.
The Marines will attack their camps at night. Snipe their leaders. Steal their artillery. Capture their very vulnerable and long supply trains leaving them without food and ammunition. Marines will move through and fight in forests and other bad terrain that break up Napoleonic formations. The Marines will never allow the enemy breathing room to maneuver into a set-piece, open field fight that Napoleonic armies are trained for.
The Marines will know all the weaknesses of a Napoleonic army and how to exploit them. In contrast, the Napoleonic commanders will have never seen anything like how the Marines fight; commanders for whom warfare has remained basically the same for the last few centuries will have to play 200 years of catch up through some of the most ferocious changes in military tactics while their men are dying.
There's no need to kill all 650,000 men of the Grande Armée, after a few weeks of this harassment by an enemy who will not stand and fight they'll desert in droves.
Simply put, a Napoleonic staff does not have the C3I to keep up with the pace of 21st century warfare. Their commanders, and their orders, will always be three steps behind the Marines.
Settle In For The Long Haul
The best course of action in this scenario is to continue to whittle away at the enemy, always avoiding an open field set-piece battle, while establishing a secure base of supply and operations to await rescue. "Liberate" a few towns and small cities, give them a decent government (even a 21st century military government will be better than a 19th century civilian one), and start reconstructing the 20th century (21st is too ambitious).
In the mid-run, they could make simple breech-loading, repeating rifles to give them a distinct firepower advantage. For example, something very simple like a Winchester Repeating Rifle would give them a devastating firepower advantage, even with black powder. With this they can fire a dozen accurate rounds in the time it takes a Napoleonic soldier to fire one poorly aimed shot.
In the long run, the Marines could establish themselves as a technocratic mercenary kingdom. Their collective knowledge of science, engineering, and particularly metallurgy, will allow them to create technological wonders; just their ability to make high-quality steel would be enough. Their military training will make them highly desired to train other armies bringing in much needed hard currency. Their 21st century administrative and social expertise will allow them to govern and organize their territory more efficiently than any neighbor. Their reputation as fierce and bewildering warriors will keep their enemies at bay.