When did he give you the password? If he gave it to you now, then you're okay. If he gave it to you while he was still your boyfriend, you probably committed a federal offense by accessing his Facebook account. You were exceeding your authorization to use the password.
In addition to Attorney Holmes' comment, I just want to add that websites like Facebook keep logs of login times and IP addresses. It is possible for a prosecutor or other attorney involved in an action to acquire those logs and correlate them to the location/account of the unauthorized logins.