Was the internal atmosphere of Mercury capsule and CSMs of Apollo missions filled with pure oxygen at low pressure, and was the ambiance controlled to match closely to that on earth (e.g. humidity, temp. etc), during their flights? If yes, why did the astronauts wear their suits while inside the capsule/CSMs?
The Apollo astronauts only wore their suits for a short time after launch. After they left the Earth orbit, they doffed the space suits.
When the two astronauts prepared for Moon landing, they donned space suits again.
Space suits were worn inside the CM and the LM only during critical intervals of the flight. If the capsule gets a hole, the astronauts continue breathing in their suits.
Of course the cabin and the suit atmosphere used both pure oxygen at the same low pressure. Temperature and humidity were controlled, both the cabin and the suit atmosphere.
After returning from the Moon surface, the astronauts repressurized the LM and removed their helmets to be able to eat and drink. The helmet could be removed and replaced much faster than the full suit.