No, you do not need to file a MD nonresident state income tax return just for buying/owning a second home in MD.
Please note that you will be able to include any mortgage interest or property taxes related to this MD second home on your federal income tax return if you itemize (under Federal Taxes>Deductions&Credits > Your
Home)