You can treat it as a "generic problem solving" type of question. @voffch gave some specific ways to do this.
You're asked why they form different structures, but don't have to say anything about their actual structures. This question sounds like something from an introductory undergrad general/inorganic course or high school honors gen chem course. Typical material for such a course discusses ionic structures in terms of sphere packing/ionic radius (keywords: fcc, bcc, hcp) and covers ionic radius in terms of electronegativity and shielding.
- Mg(II) and Ca(II) are different cations
- Their fluorides form different structures (e.g. the anion is the same)
- (you should know) Mg and Ca pretty much always are in +2
So the question is implicitly "Of the differences between Mg and Ca cations, which differences make their fluorides have different structures?."
The specific mention of F suggests there's something special about it too. F is pretty "extreme" all the way in its corner so it was probably chosen as a "superlative," e.g. "most electronegative," "smallest, "biggest occupational hazard" or something like that.
At this point, you can just compile a list of all the things you've learned about metal/halide ions over the relevant time period and pick ones that affect geometry. Also consider what you've been taught about crystal structures.
It could play out like this:
- The course covered elemental trends in ionic radius, and reasons why (electronegativity, shielding)
- The course covered simple ionic structures (sphere packing)
- Sphere packing is only affected by radius
- Mg, Ca have different radii. Both are "big"
- F is "small"
- The reason the structures are different is because Mg, Ca have different radii
- (Only if the course covered this) Mg(II) is [bigger/smaller] than Ca(II) because [electronegativity, orbitals, etc.]
By way of explanation, you can explain radius trends + draw a sketch of the different packings, approximately to scale.
If your course covered different material-- Compare Mg, Ca in terms of the stuff your course covered.