The 26-year-old has signed a three-year contract with the Bluebirds after joining for an undisclosed fee.
Ward scored 11 times in the Sky Bet Championship last season as the Millers were relegated.
Cardiff boss Neil Warnock told the club website: “I’ve worked with Danny and I know what he’s about. During my time at Rotherham he was either scoring the goals or making them for the team.
“He played wide left, right, in the hole, up front. Danny’s a crowd-pleaser with very good energy levels, but I also think there’s a lot more to come from him.
“I’ve been chasing Danny since Christmas and I think we’ve finally got him now for an excellent price.
“We tried a few systems last season and I think we’re going to need that variety again. Danny gives us that flexibility in the attacking areas that we’re going to need.
“Danny knows what I want and this is a great opportunity for him.”
— Cardiff City FC (@CardiffCityFC) June 23, 2017