The baby was struck by a stray bullet on Wednesday afternoon in the Williamsburg neighborhood, the police said.