As guinea pigs are capable of breeding at such a young age (3-4 weeks old) it is very important to make sure you've got the right sexes from the beginning. A female has a little triangle or v at the front of her anogenital opening, whereas a male has a circle with a cross on it (like a hot cross bun!).
Breeding If you do intend to breed, the timing for the female is very important. The earliest age is 5 months, and she should be bred from before she is 10 months old. This is because after this age the bones in her pelvis fuse, and make it more likely that she will have problems delivering her babies. If she has a litter before 10 months of age her pelvis will stretch to allow for childbirth, and she shouldn't have problems with any further litters when she is older.
If a guinea pig is going to have babies, she should do so before she is ten months old
Because guinea pigs carry their young for such a long time (68-70 days) they are born at a very advanced state of development. Within hours they are running around fully furred and with their eyes open, little miniatures of their parents. An experienced guinea pig keeper will able to be able to sex them immediately, but do make sure you find out what they are before they are 3 weeks old.