Assuming you had a wing design that already worked (Batman's cape will not) and the poles are already sufficiently strong and rigid, this could work.
Collapsible tent poles work by slotting the pole into a metal sleeve. There's also a bungie cord inside the pole to (lightly) pull the pieces together. The sleeve is typically stronger than the pole, as campers know tent poles tend to break at the pole, so in terms of strength there's no problem replacing complete poles with collapsible ones. It will add some weight and reduce flexibility, but it should be manageable.
Rather than joining the poles using magnets, it would be wise to retain the sleeve and cord system. It's proven tech, and your wing won't fall apart if you lose power. Where magnets come in is to pull the pole into the sleeve and ensure it's firmly seated. With some clever shaping of the ends of the poles and sleeves (funnel tip for the sleeve, round tip for the pole), this might be done reliably... though getting the complex shapes and joints necessary for a collapsible airfoil will be tricky. However if you lose power you lose tension and a pole may slip out of its sleeve. Perhaps you could have a locking mechanism, but it would also have to unlock.
What would be even more reliable is to cause the bungie cord to contract pulling the ends of the poles into the sleeves. This could be a simple mechanical operation pulling on the cord at the middle of the pole, or by separating two pole pieces and inserting a spacer.
Poles at start =====*--=====*--=====*--=====*--=====*--=====
Open a gap =====*=====*=====*------------=====*=====*=====
Insert spacer =====*=====*=====*-=========*-=====*=====*=====
Release tension =====*=====*=====*=========*=====*=====*=====
To collapse, remove the spacer releasing the tension on the cord.