Traditionaly, the Rosary is attributed to St. Dominic; most scholars agree however that this is a myth, as there are examples of Christian prayer beads/ropes dating from long before this time.
The generally accepted theory is that it originated in the Desert Fathers, as a way to count the 150 psalms. During the days of the Desert Fathers, monks were expected to know all 150 psalms by heart and to recite them every day. This used to be done by counting pebbles, but eventually they got the idea of making beads or ropes for it. Eventually, as they realized just how unrealistic this prayer rule was, they changed the expectation to reciting the entire psalter over the course of a week (hence the one-week psalter that was used in the pre-Vatican II era, and is still used today by the Orthodox). The prayer beads stuck around, however, and they became beads that they would substitute the daily 150 psalms on by repeating 150 short prayers. In the East, this developed into the Komboskini, on which the Jesus Prayer is said. In the West, it developed into the Hail Mary.
FYI this is all off the top of my head, so excuse me if there’s any errors.