Yegipko returned to the USSR in August 1938, taking up the post of commander of the Black Sea Fleet's Second Submarine Brigade. He held this position until December 1939, when he became commander of the Baltic Fleet's submarine brigade. He held this post during the Soviet-Finnish War, leaving in May 1940 to resume his studies at the Naval Academy. He graduated in April 1941, being promoted on 26 April to captain 1st rank. From that month until September he was commander of the 1st Submarine Brigade of the Baltic Fleet. Yegipko took part in military operations following the German invasion of the Soviet Union in June 1941. During the Soviet evacuation of Tallinn in August 1941, his submarine, "S-5", struck a mine, and Yegipko was blown from the conning tower into the water. He was rescued, heavily concussed, by another vessel. From September to October 1941 he was at the disposal of the Military Council of the Baltic Fleet, before his appointment as naval attaché to the Soviet embassy in the United Kingdom. As naval attaché Yegipko often acted as an observer on British warships, and sailed aboard British vessels on Arctic convoy duties.