A dispute between Caesar and the optimates faction in the Senate of Rome culminated in Caesar marching his army on Rome and forcing Pompey, accompanied by much of the Roman Senate, to flee in 49 BC from Italy to Greece, where he could better conscript an army to face his former ally. Caesar, lacking a fleet to immediately give chase, solidified his control over the western Mediterranean – Spain specifically – before assembling ships to follow Pompey. Marcus Calpurnius Bibulus, whom Pompey had appointed to command his 600-ship fleet, set up a massive blockade to prevent Caesar from crossing to Greece and to prevent any aid to Italy. Caesar, defying convention, chose to cross the Adriatic during the winter, with only half his fleet at a time. As Pontifex Maximus, Caesar was responsible for adjusting the Roman calendar at the end of each year to align it with the rotation of the Earth around the sun. As Caesar had been in Gaul and then occupied by the civil war for years, he had not been able to make this yearly change and over time, the difference between the Earth's rotation. Because of this, the calendar that Rome operated on had grown to such an extent that Bibulus, along with the others who had fled to Greece, believed that it was months later than when Caesar knew it was. As such, this move surprised Bibulus, who believed it was winter, and the first wave of ships managed to run the blockade easily. Now prepared, Bibulus managed to prevent any further ships from crossing, but died soon afterwards.
Caesar was now in a precarious position, holding a beachhead at Epirus with only half his army, no ability to supply his troops by sea, and limited local support, as the Greek cities were mostly loyal to Pompey. Caesar's only choice was to fortify his position, forage what supplies he could, and wait on his remaining army to attempt another crossing. Pompey by now had a massive international army; however, his troops were mostly untested raw recruits, while Caesar's troops were hardened veterans. Realizing Caesar's difficulty in keeping his troops supplied, Pompey decided to simply mirror Caesar's forces and let hunger do the fighting for him. Caesar began to despair and used every channel he could think of to pursue peace with Pompey. When this was rebuffed he made an attempt to cross back to Italy to collect his missing troops, but was turned back by a storm. Finally, Mark Antony rallied the remaining forces in Italy, fought through the blockade and made the crossing, reinforcing Caesar's forces in both men and spirit. Now at full strength, Caesar felt confident to take the fight to Pompey.
Pompey was camped in a strong position just south of Dyrrhachium with the sea to his back and surrounded by hills, making a direct assault impossible. Caesar ordered a wall to be built around Pompey's position in order to cut off water and pasture land for his horses. Pompey built a parallel wall and in between a kind of no man's land was created, with fighting comparable to the trench warfare of World War I. Ultimately the standoff was broken when a traitor in Caesar's army informed Pompey of a weakness in Caesar's wall. Pompey immediately exploited this information and forced Caesar's army into a full retreat, but ordered his army not to pursue, fearing Caesar's reputation for setting elaborate traps. This caused Caesar to remark, "Today the victory had been the enemy's, had there been any one among them to gain it." Pompey continued his strategy of mirroring Caesar's forces and avoiding any direct engagements. After trapping Caesar in Thessaly, the prominent senators in Pompey's camp began to argue loudly for a more decisive victory. Although Pompey was strongly against it — he wanted to surround and starve Caesar's army instead — he eventually gave in and accepted battle from Caesar on a field near Pharsalus.
Excerpt from Cassius Dio's "Roman History" gives a more ancient flavor of his take on the prelude to the "Battle of Pharsalus":
[41.56] As a result of these circumstances and of the very cause and purpose of the war a most notable struggle took place. For the city of Rome and its entire empire, even then great and mighty, lay before them as the prize, since it was clear to all that it would be the slave of him who then conquered. When they reflected on this fact and furthermore thought of their former deeds [...41.57] they were wrought up to the highest pitch of excitement....they now, led by their insatiable lust of power, hastened to break, tear, and rend asunder. Because of them Rome was being compelled to fight both in her own defense and against herself, so that even if victorious she would be vanquished."