In this view of the future, companions are registered with a guild and are much higher class than prostitutes or whores (non-guild whores being shown in one episode as a completely separate entity), being akin more to geishas. So Inara is actually of a higher social standing than Mal, being the captain of a cargo ship. Therefore, it is advantageous for Mal to have a companion on board to bring the ship some respectability. In Out of Gas, it is shown that Inara used this knowledge as a bargaining chip to get her a better price on the shuttle. Specifically, in the pilot episode, Serenity, Mal states to Shepherd Book, "There are some settlements wouldn't let you dock without a decent companion onboard." The advantage for Inara is that she gets to expand her client base by being constantly mobile. The basis for Inara leaving Serenity was established towards the end of Firefly but never given a chance to play itself out. It obviously happened at some point in between the end of the series and the beginning of the movie. But it wasn't just an idea that was originated solely for the movie.
EDIT: As far as being shunned, Shepherd Book shows some initial disapproval to her profession, but he doesn't let it interfere with his personal relationship with her.