It is generally not a good idea to keep a male and female guinea pig together unless you are prepared for breeding. Females reach sexual maturity around 2 to 3 months old, and males can impregnate them at any time after maturity. Guinea pigs breed prolifically, so you could end up with many unwanted babies.
If you want both sexes, keep them in separate cages and allow supervised playtime for socialization without the risk of unplanned breeding.