I haven’t done it. Wikitravel has most of the relevant info in English
Regular ferry service used mostly by military personnel runs between Matsu and Keelung. The Tai-Ma Ferry (tel. 02-24246868, ) takes ten hours and departs nightly from Keelung at 11pm, calling at Dongyin after eight hours and then arriving two hours later at Nangan. The return journey is an hour later, but only calls at Dongyin on alternate days. Tickets vary between NT$400 and nt NT$1200, depending on the bed (steerage, dorm, quad or twin). [/quote]
Looks like the round trip ticket is NT$882 for a seat in steerage. That’s cheaper than flying, which looks to be around NT$4000 round trip.
Here are the prices [Chinese]
Here is where you can buy tickets online [Chinese].
Service has been canceled for this week at least because of poor conditions. Matsu can be pretty miserable at this time of year.