John Harbaugh had a friendly rivalry with the San Francisco 49ers because the team was coached by his brother Jim from 2011 to 2014. As of 2015, Jim Harbaugh is not coaching the 49ers, which has weakened the rivalry.
John and Jim Harbaugh grew up together in Ohio and Michigan. Their father was a coaching assistant at the University of Michigan, which gave the brothers exposure to football from an early age. John and Jim had several fights in their youth. However, their last fight occurred in their late twenties, when Jim allegedly came close to drowning John in the ocean amidst a wrestling match meant to prove who was the dominant brother.
They later constructed their own football careers. John worked as a coaching assistant at several universities and the NFL's Philadelphia Eagles before becoming the Baltimore Ravens' head coach in 2008. Jim Harbaugh was a journeyman quarterback for 14 years before coaching at various universities. He became the head coach of the 49ers in 2011. John's Ravens defeated Jim's 49ers in a regular season game in 2011.
The rivalry was brought to the forefront again when the Ravens and the 49ers met in Super Bowl XLVII in 2012. After the Ravens defeated the 49ers again, John stated that Jim was unwilling to accept a hug from his brother. However, throughout Jim's tenure in San Francisco, the two teams maintained a professional relationship, even to the point of scrimmaging against each other in training camp. After Jim left to accept the head coaching job at the University of Michigan, John admitted that the idea of a rivalry no longer existed between the two teams.