Born at Benabarre, he was a bastard son of Alfonso VI de Ribagorza, himself an illegitimate son of King John II of Aragón. He was thus a nephew of Ferdinand II (king 1479–1516). He was in charge of re-conquering the kingdom of Naples, replacing Gonzalo Fernández de Córdoba, who had been commander there since 1495. Juan was probably a prominent and trusted person from Gonzalo's staff in Italy.
In 1479, he married a wealthy landowner, María López de Gurrea y Torrellas (died 1492). Their eldest son, born in 1487, was count Alfonso VII de Ribagorza. When his wife died in 1492, he became a member of the Order of Saint John.
He was faced in June 1508 by a popular revolt in Naples due to the lack of flour and wheat while he tried to collect extra money for military purposes. In October 1509 he had to leave the town being replaced by interim viceroy Antonio de Guevara.
In 1512 he was appointed President of the Generalitat of Catalunya but he had to leave his post, apparently due to administrative pressures in June 1514, because appointments were restricted for a while to Catholic Church authorities.