The Spanish Language came to Puerto Rico via colonization from Spain. Once the Spaniards invaded the island, it's people became subjects of the King and Queen of Spain. Spanish therefore became the official language.
For over four hundred years the Spaniards immigrated to Puerto Rico to the point that today over 70% of Puerto Ricans can trace European ancestry. While the Spanish language has retained some Taino and African words in Puerto Rico the major influences to Puerto Rican Spanish are the accents from Andalusia and the Canary islands in the south of Spain.