My friend has early onset of puberty. How do I avoid getting it?

Not contagious. You can't catch early onset puberty from someone. That said, the most common cause of early onset puberty is unknown. A smaller percentage of kids with early onset puberty have familial tendencies, pituitary and brain abnormalities.
Not contagious. Premature andronarchy is a result of a genetic problem or acquired disease. It is not due to an infectious disease therefore, you can't catch it.
You won't catch it. This is not something you can catch from her. The condition is quite rare, so don't worry. She needs to see her physician and be evaluated.