The poem is addressed to Althea, the love of the speaker's life, and the entire first stanza is about how his feelings for her help him deal with his situation. "To Althea, from Prison," then, is almost like a love letter, but it's just not about love for a girlfriend or wife (tough break there, Althea). The speaker refers several times to his love for his king, and his love of liberty. Clearly, there are many different kinds of love, and they all contribute to the speaker's ability to handle, or even surpass, his imprisonment.
Watch it, gang. Love can be a really good thing, but it can also be a form of imprisonment. The speaker is "fettered" to Althea's eyes, and "tangled in her hair."
Like two peas in a pod of emotion, love and freedom are very close. One's feelings are an important part of one's ability to experience freedom, even while confined in prison.