This is a common side effect of shaving pubic region, especially first time.
It is called pseudofolliculitis barbae, which simply means inflammed ingrown hairs. Only way to prevent is to not shave but some helpful advice: 1. Shave only in direction of "grain" 2. Trim with scissors, don't shave. 3. Use conditioner instead of shaving cream. 4. Use new razors and never, ever share razors.