Magnetic fields appear to be ubiquitous in astrophysical environments. The existence of magnetic fields in the large-scale structure (LSS) of the universe has been established through observations of Faraday rotation and synchrotron emission, as well as through recent gamma-ray observations, although their nature and origin remain controversial and largely unknown. In this talk, we first briefly review recent developments in our understanding of the intergalactic magnetic field (IGMF) and introduce a plausible model for it. We then describe how the IGMF affects the propagation of ultra-high-energy cosmic rays (UHECRs) that originate from extragalactic sources within the local universe. To this end, we set up hypothetical sources of UHECRs and virtual observers in the cosmic web magnetized with our model IGMF, and follow the trajectories of UHECRs in the intergalactic space. With our model IGMF, the paths of UHE protons and irons are deflected on average by about 15 and 70 degrees, respectively. But the IGMF at the same time contains UHECRs and the correlation between the observed UHECRs and the LSS is preserved. For instance, again with our model IGMF, the separation angles between the arrival directions and the nearest reference objects on the LSS are on average about 3.5 and 6 degrees for UHE protons and irons, respectively, which are much smaller than the defection angles. We discuss implications of our findings for correlation studies in current UHECR experiments.