As mentioned in the comments, members not in your current active party will automatically earn XP up to 1 level below whatever your PC is at currently, even when not in use. This ensures that you can freely switch members in and out of your party at will as the game progresses.
As to whether any party members are 'mandatory' at any point in the game - if nothing else, they will all have a role to play in the final battle at the end of the game. While it is possible to get through the game without equipping or assigning stats for any of them ever, all you're doing is making those moments when you will want to have them available more difficult. But no, you don't need to drag them around to ensure they're up to speed. Just take a few minutes at camp every level or so to assign stats, and give them your old gear rather than just selling it all back to the vendor so that they stay somewhat up to date on equipment.
Off the top of my head, the only party members you're required to bring with you once you get past their initial recruitment, and assuming you aren't interested in doing their own unique side quests are Morrigan and Alistair. Of course, if you want to pursue, for instance, Leilana's unique side quest, you'll need to bring her with you to a few places. Same, for instance, with Shale.