Whenever any female person is committed to the Commissioner of Correction or any reformatory institution for girls or women in this state, the court making such commitment shall, unless such person is to be accompanied by a member of her own family, direct that some responsible woman shall accompany her; provided, in emergency cases, where no such woman is available, the court may make such other order as security and respect for the person of the female may require. The necessary expenses and the compensation, if any is required, for such attendant shall be taxed and allowed by the court as costs in such action.