Their nuances are different, and you need to decide each time which is appropriate.
When を is used:
秘書を伴って: You are the main person, and your secretary is accompanying you.
危険を伴う手術: The main event is surgery, and some danger comes with the surgery.
秘書を伴って
You are the main person, and your secretary is accompanying you.
危険を伴う手術
The main event is surgery, and some danger comes with the surgery.
When に is used:
父に伴って: Dad is the main person, and you are accompanying him.
人口増加に伴う住宅問題: The main (first) event is population growth, then housing problem comes after that.
父に伴って
Dad is the main person, and you are accompanying him.
人口増加に伴う住宅問題
The main (first) event is population growth, then housing problem comes after that.
With 時間を伴う or 時間に伴う:, "Something;something happens with the passage of time", so time comes first, then then something happens. Therefore, therefore 時間に伴って is appropriate. See also Tsuyoshi Ito's comment.