Yes you can deposit a money order that's in your name into someone else's bank account as long as both you and the person who's name is on the bank account is with you at the bank when you deposit it.
And yes if you owe someone money and want to deposit the money order into someone else's bank account then sometimes you can do that while some other banks won't allow it.
You'll need the persons name and bank account number to do so and not all banks will allow you to deposit the money order into someone's bank account.