McMahon, 27, can also be deployed in an attacking midfield role.
An employment tribunal recently ordered Portadown to pay £7,000 in unpaid wages to McMahon, an outcome the Shamrock Park club say they will appeal.
In June, an Irish FA disciplinary hearing ruled that McMahon had been paid while registered as an amateur.
The registration case led to a 12-point penalty being handed down to the Ports, a decision which they are also in the process of appealing.
Swifts head coach Rodney McAree described McMahon as "a wonderful talent".
"The fact the Swifts play good football really made me want to join the club. I watched last season and anytime I saw them play I thought 'they play the game the right way' and that has attracted me to the club without a doubt," McMahon told the Dungannon FC website.
Dungannon lie fifth in the Premiership table and travel to Seaview to face champions Crusaders on Saturday.
Dungannon Swifts have completed the signing of former Portadown and Bohemians forward Peter McMahon on a one-year deal.