To get/be on the wrong tack = to be headed/going in the wrong direction
From the OED:
6. a. An act of tacking (tack v.1 7); hence, the direction given to a ship’s course by tacking; the course of a ship in relation to the direction of the wind and the position of her sails; a course or movement obliquely opposed to the direction of the wind; one of a consecutive series of such movements to one side and the other alternately made by a sailing vessel, in order to reach a point to windward.
A ship is said to be on the starboard or port tack as the wind comes from starboard or port. At each change of tack, the relative positions of the tack and sheet of the courses are reversed.