No it is not necessary to change the front and rear brake pads at the same time. It is however common to replace both front caliper brake pads at the same time and similarly, the rears.