You do not have to stay in Missoula, but transportation will be taking everyone back to Missoula the night of the wedding. If you are staying somewhere else, you will have to drive yourself back to your place to stay. In addition transportation will take everyone to the Holiday Inn in Downtown Missoula. There are many hotels/airbnbs walkable to this hotel in the downtown area.
If you want to do both parks it may be easiest to fly into Missoula for Glacier National Park, driving to Yellowstone and then flying out of Bozeman MT to reduce driving. Or vice versa!