The South African court ruled that a law banning husbands from adopting their wives’ surnames was unconstitutional.