Pope John Paul II's visits to Nicaragua were made in March 1983 and February 1996.
1983.
In March 1983, Pope John Paul II made a pastoral visit to Nicaragua. The visit took place amidst the ongoing Contra war, a period of extreme polarization between the Nicaraguan Catholic hierarchy and popular sectors of the Nicaraguan Church and heightened tensions between the hierarchy and Sandinista state. 
Both the Nicaraguan Catholic Church and the Sandinista government eagerly anticipated the arrival of the Pope. The hierarchy believed that the Pope would give moral legitimacy to their efforts to combat the "godless communism" of the Sandinista government. On the other hand, the government hoped that the Pope would offer support for the peace process by acting as a mediator and by formally voicing his opposition to American aid to the contras. Consequently, the Sandinistas made a tremendous effort to encourage Nicaraguans to attend the two papal masses that were held in León and Managua. The day of the Pope's visit was declared a national holiday and citizens were offered free transportation to the masses.
Rather than helping to alleviate the hierarchy-state tensions, the Pope's visit exacerbated them even further. The Pope stressed the importance of Church unity as the best way to prevent Nicaragua from being corrupted by "godless communism". He spoke out against the growing division within the Church between the "popular church" and the institutional hierarchical Church. He also advocated the authority of the bishops and the importance of religious education. The Pope affirmed the Vatican's support for the conservative Archbishop, later Cardinal, Miguel Obando y Bravo and spoke out against the five Nicaraguan priests (including Ernesto Cardenal) who held government positions, privately urging Cardenal, "Regularize your position with the Church." Priests and bishops, because they are considered agents and 'spouses' of Christ and the Church upon their ordination, are not supposed to hold political office, especially high offices or compensated offices or offices that could influence the Church in society, under the laws of the Catholic Church. The Pope was repeatedly interrupted during the Mass, which eventually made him angry (see the papal biography by George Weigel).
The Pope's visit convinced the vast majority of Nicaraguan people that the Vatican was not in tune with their problem. For instance, the day before the Pope's visit to Managua, a funeral service was held to commemorate the lives of 17 Sandinista supporters who were killed by the Contras in the same plaza that the Pope's mass took place. The Pope made no reference to the incident, even words of condolence.
The Pope's visit was a significant event in the civil war. It deepened tensions between the Sandinistas and the many Nicaraguan Catholics who supported the Sandinistas. The controversial visit was also used by the "Contras" as a form of propaganda to give their organization moral legitimacy.
1996.
In 1996, Pope John Paul II visited Nicaragua for a second time as part of a trip in which he also visited Guatemala, El Salvador, and Venezuela. The trip lasted from February 5-12.